Making a loaded spring
-
I'm trying to set up a model where a spring is triggered after an object collides with it... I can set it up so that when I manually double-click it, it triggers, but what do I need to do is trigger it when another object hits it (or the object that it is grouped with.
Does anyone have any advice? -
Assuming you have SketchyPhysics 3 experimental (SP3 X), you can use onTouch to help with this. First, instead of a spring, use a slider, set a fixed value (0) as the controller, and play with the accel and damp until you get it satisfyingly springy. You can then replace the controller with a variable, e.g. getVar("spring",0)
Then, in onTouch of the same object, use setVar("spring",1)This means that when the object is touched, the 'default' position of the springy slider will move from the 0 position to the 1 position.
Advertisement