sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SketchyPhysics - New Grip System for Cars ! !

    Scheduled Pinned Locked Moved SketchyPhysics
    16 Posts 6 Posters 2.9k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      MrDailyBlah
      last edited by

      Ever built a sketchyphysics car? And theres no grip on the ground? Well never fear, 'cos MrDailyBlah is here....(!) 😍 (!)

      I recently fiddled around with the raytest function, and i thought i could incorporate it in to the sim...

      A floor in sketchyphysics is perfectly smooth...it doesnt create friction like a normal surface would. To create more grip, the most obvious solution is to apply negative thrust to the car's body or suspension, but this collapsed the wheel hinges. ❓ ❗ 😒

      I tried to use magnetism as a solution, and i found that if i could use the raytest function, i could find a point under each wheel on the floor, to each of which i can teleport a magnetic object, attracting the wheels to the floor and creating grip without collapsing the car... πŸ€“ πŸ˜„ πŸ‘

      That was it in a nutshell... here's the code i used -

      
      # paste the following into the floor
      onstart{
      # a way to simplify Sketchup.active_model.raytest
      def newRay(p,d)
      ray=Sketchup.active_model.raytest(p,d)
      return ray
      end
      }
      # then i copied the following script 2 each wheel
      ontick{
      t=[0,0,-1]
      ray1=newRay(position,t)
      ray2=newRay(ray1[0],t)
      s=@simulation.findBody("sphere...") # the magnetic object; theres a unique one 4 each wheel
      s.teleport ray2[0] if (ray2!=nil) and (s!=nil)
      }
      
      

      heres a demo of the script

      P.S. make sure u know how it works befor u copy it... ( πŸ˜• )

      1 Reply Last reply Reply Quote 0
      • iichiversiiI Offline
        iichiversii
        last edited by

        This is great, nice feature, thanks

        Bring on the Rain...

        1 Reply Last reply Reply Quote 0
        • M Offline
          mptak
          last edited by

          What a nice Holiday present. Can't wait to try it...(once I understand it (:)).

          1 Reply Last reply Reply Quote 0
          • D Offline
            Don East
            last edited by

            Where did you put this script?
            Don

            http://sketchupbydawn.blogspot.com/

            1 Reply Last reply Reply Quote 0
            • M Offline
              MrDailyBlah
              last edited by

              @don east said:

              Where did you put this script?
              Don

              u need to put it in the "scripted" section of the Sketchyphysics UI (neither the "ontick" or "ontouch" section would work...)

              1 Reply Last reply Reply Quote 0
              • H Offline
                hobbnob
                last edited by

                Hehe not a bad idea, but you could just have put push([0,0,-1]) in the ontick field of the wheel, does exactly the same thing πŸ˜„

                (little extra note, if you want to have the vehicle turn on it's side/upside down and still have it work, then encase your steering block around the drive joint (either hinge or motor dependign on your preference) and they won't collapse)

                My WIP Thread:Here

                1 Reply Last reply Reply Quote 0
                • M Offline
                  MrDailyBlah
                  last edited by

                  @hobbnob said:

                  Hehe not a bad idea, but you could just have put push([0,0,-1]) in the ontick field of the wheel, does exactly the same thing πŸ˜„

                  (little extra note, if you want to have the vehicle turn on it's side/upside down and still have it work, then encase your steering block around the drive joint (either hinge or motor dependign on your preference) and they won't collapse)

                  uh..well.. push([0,0,-1]) creates a violent vibration in the wheels.. so its not that simple.. 😞 ❗

                  p.s. i looked in ControllerCommands.rb and found the push()method is the same as $sketchyPhysicsToolInstance.pushBody(), which creates the vibration i talked about... 😒

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    hobbnob
                    last edited by

                    I haven't had that problem in the 4 years I've been using sketchyphysics, you sure you've got your wheels geom and ontick interval set up correctly?

                    My WIP Thread:Here

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      MrDailyBlah
                      last edited by

                      @hobbnob said:

                      I haven't had that problem in the 4 years I've been using sketchyphysics, you sure you've got your wheels geom and ontick interval set up correctly?

                      sure as pants man.. ❓ ❗ 😲

                      1 Reply Last reply Reply Quote 0
                      • ashscottA Offline
                        ashscott
                        last edited by

                        Yeah I have the same issue with Hobbnobbs micro script - I am building a walking machine - the fluctuation which is somehow included in hobbnobs micro script causes my machine do hover and float around slowly.

                        When I implement MrDailyBlah's I get the kind of traction for my machine's feet that I was looking for. Can increase traction by changing the value'-1' in the part of the script that goes in the wheel to '-2'. Nice work

                        I've got no idea where the vibration is coming from - funnily enough, the other two variables marked '0' in hobbnobs script control push in a certain direction. You can make your machine/vehicles hover in certain directions using these variables.

                        Just some stuff I do with Sketchup.

                        1 Reply Last reply Reply Quote 0
                        • ashscottA Offline
                          ashscott
                          last edited by

                          I've added a little complexity that is causing this script to crash SP when I try to run it.

                          As far as I can tell it has something to do with the raytest function - potentailly related to the issue described on this thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=30558

                          I have tested it in SU7 as well but am getting the same issue - basically the model explodes, the POV zooms way out and all I can find left in the model is a bunch of endpoints (like on the end of a tapemeasure guide......can anyone shed some light?

                          Ash

                          Just some stuff I do with Sketchup.

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            MrDailyBlah
                            last edited by

                            @ashscott said:

                            I've added a little complexity that is causing this script to crash SP when I try to run it.

                            As far as I can tell it has something to do with the raytest function - potentailly related to the issue described on this thread: http://forums.sketchucation.com/viewtopic.php?f=180&t=30558

                            I have tested it in SU7 as well but am getting the same issue - basically the model explodes, the POV zooms way out and all I can find left in the model is a bunch of endpoints (like on the end of a tapemeasure guide......can anyone shed some light?

                            Ash

                            that's right sir...
                            i used raytest to find the point where the wheels touch the floor, then i teleport magnets to them to attract the wheels... πŸ€“

                            1 Reply Last reply Reply Quote 0
                            • ashscottA Offline
                              ashscott
                              last edited by

                              But Raytest has a tendency to cause SU to flip out - know of a workaround or why I am having the symptoms described?

                              Just some stuff I do with Sketchup.

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                MrDailyBlah
                                last edited by

                                @ashscott said:

                                But Raytest has a tendency to cause SU to flip out - know of a workaround or why I am having the symptoms described?

                                uh... 😲 nooo...
                                u'd better consult pros like Wacov.. πŸ˜•

                                1 Reply Last reply Reply Quote 0
                                • ashscottA Offline
                                  ashscott
                                  last edited by

                                  So you're not getting the issues I described two posts ago.....?

                                  I seem to get it no matter how I run it (apparently the raytest issue was clashing with SU8 but I can't even get it working right in SU7)

                                  Just some stuff I do with Sketchup.

                                  1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    MrDailyBlah
                                    last edited by

                                    @ashscott said:

                                    So you're not getting the issues I described two posts ago.....?

                                    I seem to get it no matter how I run it (apparently the raytest issue was clashing with SU8 but I can't even get it working right in SU7)

                                    try reinstalling sketchup or SP or sumthing πŸ˜• ...

                                    1 Reply Last reply Reply Quote 0
                                    • 1 / 1
                                    • First post
                                      Last post
                                    Buy SketchPlus
                                    Buy SUbD
                                    Buy WrapR
                                    Buy eBook
                                    Buy Modelur
                                    Buy Vertex Tools
                                    Buy SketchCuisine
                                    Buy FormFonts

                                    Advertisement