Community Forum

Creating / Removing joints

Forum Overview >> Scripting

CategoryScripting
Created02.06.2010 17:17


Daniel Evans (Unknown) 02.06.2010 17:21
I am trying to create a physics joint through Lua, so far I've found the JointConstructor object, which works. But I can't seem to find anything to remove joints via script? Is there any way to destroy a joint?
I'm also wondering why the JointConstructor isn't documented anywhere, is it just that nobody has done it yet?

Tobias F (JD6930) 03.06.2010 23:18
removeJoint(jointIndex);

:D

Daniel Evans (Unknown) 13.06.2010 18:09
awesome, thanks. One more question:
I'm trying to turn the joint by setting it's rotation limit. Like this:
self.joints[i].newRotLimit = math.max(self.joints[i].newRotLimit - self.joints[i].rSpeedZ*(dt/1000), self.joints[i].zMin);
setJointRotationLimit(self.joints[i].node2, 2, true, math.rad(self.joints[i].newRotLimit), math.rad(self.joints[i].newRotLimit))
However, this doesn't seem to affect the joint at all

Stefan Geiger - GIANTS Software 16.06.2010 15:14
Unfortunately joint limits need to be symmetric to the 0 rotation.

You can use the setJointFrame function to rotate the joint

setJointFrame(jointIndex, anchorActor, transfromGroupId);

anchorActor (0 or 1) is the actor where the joint is moved. The relative position of the joint to the other actor is not moved.


Note: Log in to post. Create a new account here.