sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SketchyPhysics 3x June 27 version.

    Scheduled Pinned Locked Moved SketchyPhysics
    95 Posts 12 Posters 23.0k Views 12 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.
    • C Offline
      CPhillips
      last edited by

      Here is a script that makes a simple to use auto connecting joint. In the first frame. The "pin" object automatically connects to any "door"'s it is touching with a hinge and anything else with a fixed joint. What makes it really useful is it copyable. ๐Ÿ˜„

      Note I made the "pin" object very dense and no collide. It didn't work very well otherwise.


      doorandpin5.skp

      1 Reply Last reply Reply Quote 0
      • W Offline
        Wacov
        last edited by

        Thanks for the tips Chris. Here's some movable, breakable objects (Kinda laggy, but fun ๐Ÿ˜„ )


        Breakables.skp


        Breakable wall.skp

        http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

        1 Reply Last reply Reply Quote 0
        • J Offline
          JaViXP
          last edited by

          Well done I like it! ๐Ÿ‘

          So, Chris, any new features we missed? ๐Ÿ˜„

          "Giving up is way harder than trying"
          JaViXP's Rendering

          1 Reply Last reply Reply Quote 0
          • W Offline
            Wacov
            last edited by

            Took quite a while to code this right, and I can't get the faces to smooth, but here it is! Seamless cloth!!


            (Although it's not copyable)

            http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

            1 Reply Last reply Reply Quote 0
            • P Offline
              phy
              last edited by

              Um, CPillips how do you use the breakit command or is it a command. I don't mean the split command by the way. Wacov that's fantastic. ๐Ÿ‘

              Tableau de comparaison de Staxyn s'agit d'un mะ“ยฉdicament uniquement sur ordonnance.

              1 Reply Last reply Reply Quote 0
              • W Offline
                Wacov
                last edited by

                I'm on a roll...

                Turns out you CAN reset the simulation from within the script. Use this little chunk of code:

                @@bPause=true
                SketchyPhysicsClient;;physicsReset()
                MSketchyPhysics3;;closeControlPanel()
                freeDirectInput()
                

                In the scripted field.

                I found this near the bottom of SketchyPhysicsTool.rb, it seems to work totally normally for me, but if there's a problem, there's not much I can do about it ๐Ÿ˜„

                http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                1 Reply Last reply Reply Quote 0
                • J Offline
                  JaViXP
                  last edited by

                  That sounds cool! I can't try this though, it displays an error ๐Ÿ˜ž

                  By the way, is there a way to stop the simulation and save it as the model? I mean, you are running the simulation with a breakable box, the box is broken, can you copy the model and paste into other model? (Sorry, my English is hard to understand ๐Ÿ˜ณ )

                  "Giving up is way harder than trying"
                  JaViXP's Rendering

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    phy
                    last edited by

                    It doesn't work for me ether wacov I get this error, taken from the ruby console:

                    String doesn't compile; Error in Script:
                    @@bPause=true
                    
                    SketchyPhysicsClient;;physicsReset()
                    
                    MSketchyPhysics3;;closeControlPanel()
                    
                    freeDirectInput()
                    (eval);4;in `initEvents'; undefined method `freeDirectInput' for #<MSketchyPhysics3;;SP3xBodyContext;0x5dd6378>#<RuntimeError; Error in Script&#058;
                    @@bPause=true
                    
                    SketchyPhysicsClient;;physicsReset()
                    
                    MSketchyPhysics3;;closeControlPanel()
                    
                    freeDirectInput()
                    (eval);4;in `initEvents'; undefined method `freeDirectInput' for #<MSketchyPhysics3;;SP3xBodyContext;0x5dd6378>>
                    C;/Program Files/Google/Google SketchUp/Plugins/SketchyPhysics3/ControllerCommands.rb;966;in `initEvents'
                    

                    and Javi just pause the simulation and save the model.

                    Tableau de comparaison de Staxyn s'agit d'un mะ“ยฉdicament uniquement sur ordonnance.

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      CPhillips
                      last edited by

                      @javixp said:

                      Well done I like it! ๐Ÿ‘

                      So, Chris, any new features we missed? ๐Ÿ˜„

                      Well, there is a lot that is still possible. I haven't seen anyone using teleport yet. Nor getVelocity/setVelocity, getTorque/setTourque or setLinearDamping/setAngularDamping. Any script connected joint can also be disconnected but I dont know a good example for that. Also the scripted code area will take tabs now. That makes it easier to write readable script.

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        CPhillips
                        last edited by

                        @wacov said:

                        I'm on a roll...

                        Turns out you CAN reset the simulation from within the script. Use this little chunk of code:

                        @@bPause=true
                        > SketchyPhysicsClient;;physicsReset()
                        > MSketchyPhysics3;;closeControlPanel()
                        > freeDirectInput()
                        

                        In the scripted field.

                        I found this near the bottom of SketchyPhysicsTool.rb, it seems to work totally normally for me, but if there's a problem, there's not much I can do about it ๐Ÿ˜„

                        I am not sure that will work correctly in all cases. Ill try to add something official.

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          CPhillips
                          last edited by

                          @wacov said:

                          Took quite a while to code this right, and I can't get the faces to smooth, but here it is! Seamless cloth!!

                          Very impressive Wacov!

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            CPhillips
                            last edited by

                            @phy said:

                            Um, CPillips how do you use the breakit command or is it a command. I don't mean the split command by the way. Wacov that's fantastic. ๐Ÿ‘

                            "breakit" is an internal command called by "split". If you want to break an object into more than 2 pieces use this:

                            
                            split(self,2)
                            
                            

                            The "2" means split twice, so you'll get 4 pieces. If you use 3 you will get 16 pieces. 4=256. So dont go nuts. Also remember Sketchup will sometimes crash when you split. The more splits the more likely this is to happen.

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              CPhillips
                              last edited by

                              I was going to do an example for split, but it turns out there are some more bugs with it. It wont work in "onstart" for example. use this instead:

                              ontick{
                                 if(frame==1)
                                    split(self,2)#break into 4 pieces 
                                    ontick{} #disable ontick
                                 end
                              }
                              
                              1 Reply Last reply Reply Quote 0
                              • P Offline
                                phy
                                last edited by

                                Okay thanks.

                                Tableau de comparaison de Staxyn s'agit d'un mะ“ยฉdicament uniquement sur ordonnance.

                                1 Reply Last reply Reply Quote 0
                                • W Offline
                                  Wacov
                                  last edited by

                                  Got cloth smoothing working, and made it easier to change the scripting (everything's in the floor). Chris, it seems if there's a script error in onend, objects fail to move back to their starting positions... and it can't be undone ๐Ÿ˜• Try sticking jargon in onend, and see for yourself.

                                  Anyway, the updated cloth!


                                  Cloth wth smooth faces.skp

                                  http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    CPhillips
                                    last edited by

                                    @wacov said:

                                    Chris, it seems if there's a script error in onend, objects fail to move back to their starting positions... and it can't be undone ๐Ÿ˜• Try sticking jargon in onend, and see for yourself.

                                    Thanks. I fixed it.

                                    1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      CPhillips
                                      last edited by

                                      This script is inspired by a new model on 3dwarehouse that ran really smooth... once I turned off shadows and edges.

                                      Paste this into one objects scripted field. It tries to speed up the rendering by disabling shadows and edges during the simulation. Don't worry if you dont understand it. It should be plug and play.

                                      onstart{
                                            #save current settings
                                         ropts=Sketchup.active_model.rendering_options
                                         sopts=Sketchup.active_model.shadow_info
                                         @saveROpts=ropts.collect{|k,v|[k,v]}
                                         @saveSOpts=sopts.collect{|k,v|[k,v]}
                                      
                                            #changes to speed up render
                                         ropts["EdgeDisplayMode"]=0
                                         sopts["DisplayShadows"]=false
                                      
                                      }
                                      onend{
                                            #restore render settings.
                                         @saveROpts.each{|k,v|; Sketchup.active_model.rendering_options[k]=v}
                                         @saveSOpts.each{|k,v|; Sketchup.active_model.shadow_info[k]=v}
                                      }
                                      

                                      Original model. http://sketchup.google.com/3dwarehouse/details?mid=3107b3d9c4c935b2b006aed51312d6bb&prevstart=0

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        JaViXP
                                        last edited by

                                        Thanks, that script will be really helpful ๐Ÿ‘

                                        The bot... Love playing with it! ๐Ÿ˜† (I know it's Pecoler's)
                                        By the way, how do you keep the breakable objects already broken? I mean, they are crashed and the simulation didn't start.

                                        "Giving up is way harder than trying"
                                        JaViXP's Rendering

                                        1 Reply Last reply Reply Quote 0
                                        • W Offline
                                          Wacov
                                          last edited by

                                          Uh... Chris... the Joystick commands don't work. I know you said it's all completely new, but that seems like a step backwards ๐Ÿ˜•

                                          You can bridge the gap using global variables, but that's the only way I can find... here's a demo:


                                          Fixed, hopefully

                                          http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                                          1 Reply Last reply Reply Quote 0
                                          • P Offline
                                            phy
                                            last edited by

                                            Um, Wacov is the file supposed to not work?
                                            Okay it works now.

                                            Tableau de comparaison de Staxyn s'agit d'un mะ“ยฉdicament uniquement sur ordonnance.

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

                                            Advertisement