SketchyPhysics 3x June 27 version.
-
Basically, you use:
ontouch{ #your code here #code #code #more code #etc }
In the scripted field. The code you put between the brackets will be executed, in the case of ontouch, upon every collision with another object. ontick{...}, onuntouch{...}, and ontouching{...} work in basically the same way, with ontick executed every frame, onuntouch whenever the object stops colliding, and ontouching every frame the object is colliding with another. With any of the the touch events, you can also access the object being collided with, the exact point3d of the collision, and the impact speed of the collision, using:
ontouch{|toucher,speed,pos| #code }
You can then use them as variables in your event code.
-
Thanks Wacov. Much appreciated.
-
Hello!
When I try the "ontouch" in script-field event it will not work:SEx. I have a "button" (box), and when I push that button it touch another box with the script (easy one, see below) the physics engine freeze and I need to restart the physics-simulator.
Here is the simple code I use:
ontouch{ setVar("var1",1) }
Why does the physics-simulator freeze?
And will this script set the "var1" to "0" (zero) when I relase the button?Thank´s for help.
/hpnisse -
-
Does anyone know of a way to allow for a Servo joint to rotate multiple revolutions?
It seems like the maximum workable range for the Servo joints are 360 Degrees (2*pi radians) symmetrical about the starting angle, and when exceeded the joint starts to endlessly spin around. I am looking to achieve multiple revolutions while still maintaining angular position control. Any ideas would be welcome. Thanks!
-
The only way I know is to use multiple, stacked servos (i.e. one group ontop of the other, with the same controller for both joints)
-
@jeremygbertin said:
Does anyone know of a way to allow for a Servo joint to rotate multiple revolutions?
It seems like the maximum workable range for the Servo joints are 360 Degrees (2*pi radians) symmetrical about the starting angle, and when exceeded the joint starts to endlessly spin around. I am looking to achieve multiple revolutions while still maintaining angular position control. Any ideas would be welcome. Thanks!
I've still been working to find a way to create exact position control over multiple revolutions. I've been experimenting with an alternative method involving linking a Gyro to a Hinge and specifying gyro X-Y vector coordinates (for the plane orthogonal to the hinge axis) to set the angle of my object attached to the hinge.
This method works fine for setting the angle of the hinge initially, but for some reason it seems like the Gyro is not able to be dynamically controlled while the simulation is running...? In the Controller field I have tried using variables, the 'slider' control, and key presses, but I can not figure out how to force the Gyro to be updated.
Any ideas? Thanks.
-
Is there any scripts to put sound in SP 3X?
-
-
Hey Chris:
I am having problems with the Linear Damping on objects. Some C++ Sketchup script is terminating Sketchup after a number of frames whenever I have it running. It has something to do with Runtime. Do you know what might be happening? Thanks in advance, Chris
EDIT: It only happens when I set Linear Damping before altering gravity.
Advertisement