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

    Working on new scripting system.

    Scheduled Pinned Locked Moved SketchyPhysics
    68 Posts 14 Posters 10.1k Views 14 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.
    • W Offline
      Wacov
      last edited by

      Could I make one small request? Could you set SP to run every script in a model once, when it is loaded? This would stop the error messages popping up when I try and edit a script that uses a method or variable, that's set in another script, which itself hasn't been run yet.

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

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

        Due to how they work I cant make it do that with the OnTouch and OnTick fields. But the new scripted field does it. Its a lot better.

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

          I got teleport working tonight. Its a lot of fun. I made a car that teleports back to the start if it flips over.

          But disconnecting joints is proving to be difficult. If I want to maintain backward compatibility it might be that only certain joints can be disconnected.

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

            With the teleportation, will the camera be moved if it's following a teleported object? And could you have a breakable object, which, when broken, teleports back to the starting position with all its joints intact?

            I think as long as we can break fixed joints on command it should be alright. Oh, and I just thought of a possible solution to the deletion problem; maybe, while the simulation is running, you create a new, invisible layer. When the script 'deletes' an object, just move it into that layer and set its state to ignore... then just change it back and remove the new layer at the end of each simulation!

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

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

              Yes to the camera. I dont know about the breakable objects.

              Next version you should be able to destroy objects.

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

                This stuff is great. UM,can I ask when the next version is going to out. 😒 😄

                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

                  Not sure. Everytime I mention a date or a timeframe for a release I wind up missing it.

                  And speaking of breakable... I worked on something a little different today. 😄

                  shatter1.JPG
                  shatter2.JPG
                  shatter3.JPG

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    BTM
                    last edited by

                    Awesome! THAT must have been hard to do 😕

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

                      Did you split that manually, or was it randomly split at the initiation of the simulation? And if you did figure out the script that splits an object, can you control the breaking force, if possible?

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

                        I wrote a script that splits an object N times and I call it from the new OnTouch event. So it is "broken" at collide time. Right now it is a totally random shatter rather than splits at the point of contact. But I might be able to make it to a more realistic now that OnTouch now has info about how fast and exactly where bodies collide.

                        The other problem is the pieces don't inherit the movement of the original object. So that big box drops to the floor, stops on a dime and shatters, and then slowly falls to pieces. I need to figure out how to give the pieces velocity and rotation.

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

                          Ok, that's REALLY awesome... first, does it split the actual geometry, or the collision mesh? And one important thing would be efficiency; would we be able to set the generated pieces to noCollision, and delete them after a timer? Or better yet, create the biggest pieces normally, but on a deletion timer, and make the smaller pieces noCollision.

                          And I'm pretty sure it won't, but will it break in response to tension and/or internal stress? For example, putting a heavy weight in direct contact, without dropping it, or hitting it with an extremely powerful magnet.

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

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

                            That looks so cool, can't wait. But I have a question is this version going to still be sp3 or is it going to be spIV? Are we going to be able to control how many places the breakable script breaks? Also in the next version will we be able to group joints multiple times?

                            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

                              Just collision and only simple shapes (not compound). And it just works with contacts not stresses. I dont think it would be possible to do stress. Not sure if it will be in SPIV or SP3. There are a lot of problems with it right now.

                              I dont know the answers to the rest yet.

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

                                There is a big problem with the breaking feature. The actual breaking of the geometry is very slow. It can take several seconds to break a model.

                                Error 404 (Not Found)!!1

                                favicon

                                (sketchyphysics2.googlecode.com)

                                Maybe it can be optimized somehow. But I am going to go back to the scripting stuff for now.

                                1 Reply Last reply Reply Quote 0
                                • B Offline
                                  BTM
                                  last edited by

                                  @cphillips said:

                                  There is a big problem with the breaking feature. The actual breaking of the geometry is very slow. It can take several seconds to break a model.

                                  Error 404 (Not Found)!!1

                                  favicon

                                  (sketchyphysics2.googlecode.com)

                                  Maybe it can be optimized somehow. But I am going to go back to the scripting stuff for now.

                                  I would have guessed that. Maybe you can get sketchyphysics to figure out how to break the object at the start of the animation, then find the object's position and orientation on the collision and break it, or replace it with the broken pieces already made at the start, but not used. Just a thought, I don't have a clue how you're doing it currently, so I'm just throwing this out there 😆

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    Sgal
                                    last edited by

                                    @wacov said:

                                    With the teleportation, will the camera be moved if it's following a teleported object? And could you have a breakable object, which, when broken, teleports back to the starting position with all its joints intact?

                                    To fix the camera problems I think the best would be a "camera" joint. I know that In other 3D programs they are commonly used. It would be more user-frendly,too.
                                    This is what I mean:


                                    Boooo.PNG

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      Sgt.A.Johnson
                                      last edited by

                                      So when the sim starts the camera moves into it and faces wherever the joint is facing right. Seems like a good idea if ive interpreted it right

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

                                        Its not exactly a joint but I am making the camera a lot better. 😄

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

                                          The new scripting interface is making it much easier to expose the functionality of the physics engine. Full material support will have to wait until SPIV, but you can now change object density and linear/angular damping. That means you can have one object weight more or less than an identical object.

                                          Error 404 (Not Found)!!1

                                          favicon

                                          (sketchyphysics2.googlecode.com)

                                          Orbital mechanics type stuff now works because you can set damp to 0.0. Or even set it high to make objects act like they are in quicksand.
                                          http://sketchyphysics2.googlecode.com/files/orbit.avi

                                          Also exposed is velocity and torque. You can make an object that starts in motion or rotating.

                                          Teleporting is working well now. I tried to make a "portal" type object but it is proving harder than I expected. 😄

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

                                            All this stuff is SO awesome... when you say linear/angular damping, will that act like a basic kind of air resistance? And what I'm really interested in, is if you set density to 0, what happens? Is it truly 0... i.e no weight or inertia? As long as it works ok as a noCollision object, attached to something else, then it's fine. Then with the torque and velocity; can you set them at runtime? And can you retrieve the object's current torque and velocity?

                                            And, out of interest, isn't it now possible, with a few workarounds, to copy/paste and emit complex (jointed) objects? Just automatically connect each object with script at the beginning of the simulation, and do the same thing with emitters (if we can set an emitted object's script field...?)

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

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

                                            Advertisement