Joints, and how to remove them

Hello everyone,

I am currently doing some tests with jme physics, and I have used HingeJoints for the first time this morning.
Everything works as planned.

I was wondering if it is possible to ‘release’ the object, or to destroy the joint, to let the objects fall down. joint.destroy() does not work.

Is it possible to do that, and if so, how?

No one wanna shoot some trouble?

Have you tried simply removing the joint from the physic space?

No, I haven’t.
Yes, it works.

Apparently joint.destroy() is a useless function (found in PhysicsJoint).

This is how it’s should be done. :thumbsup:

edit: the destroy method should be called on the removal of the joint from the physic space. The method just remove the joint for a list in the each bodies, so it just prevent the list of joint from growing …

1 Like

Is it the users job to call destroy on a physics body? I know that it destroys the internal byte buffers but you would think that this would be called automatically at some point, right?

I don’t think it to the user to call destroy, it should be called by the PhysicsSpace on the removal of a joint.
The destroy method has nothing to do with byte buffer, but with ArrayList, it only remove the physicsJoint reference from the two bodies joints list.

Ok, thanks for clearing that up. I actually had to look up some code on github to confirm what you we’re saying because I swore that I saw that at some point. But ya you’re right. Turns out that I was thinking of the destroy method in the PhysicsRigidBody in jBullet, which removes it from memory. The method doesn’t exists anymore in native bullet.

I believe it isn’t called internally. I haven’t checked it out completely though.

As i said it isn’t called internally but it should be. And it should not be called by the user.
This can make an easy contribution : adding a call to destroy() in removeJoint(PhysicsJoint joint) in