- Home /
How to truly lock an axis in a configurable joint?
I know how to "lock" both movement and rotation on the different axis in a configurable joint, but when selecting it, its not actually locked at all it seems. It is allowed to move around as it wants to, all it takes is enough force. And the bigger difference between the mass of the object that got the joint, and the object the joint is attached to, the smaller force it takes to move it "freely".
It seems like "locking" only "creates a spring" to hold it in place, not actually locking the movement or rotation at all. So i wonder, are there any way to truly lock a configurable joint?
If not, are there atleast any way to strengthen the joint, so that it takes like 1 000 times more force to pull/push it out of its position?
Answer by jkraptor · Aug 27, 2015 at 02:31 PM
Some people add a fixed joint temporarily to lock, but that would lock all axes. The the NVidia Physx website has some suggestions about how to deal with the difference in masses when using any joint.
https://developer.nvidia.com/sites/default/files/akamai/physx/Manual/Joints.html
see the section at the end of the page on : Configuring Joints for Best Behavior
If your seeing separation at the joint, try increasing the number of iterations on the physic solver. That tends to hold joint together better. (Project Settings > Physics > Solver Iteration Count).
(I realize that this answer comes 2 years later - it's for the benefit of others that may read your post).
Answer by Ravenflash · Dec 05, 2018 at 10:59 PM
I just had a problem like that and couldn't find any real and simple solution. So started to playing with some scripting and this script seems to solve my problem for now.
It messes up with physics, so I added a condition to use this forced rotation only when needed. Otherwise my parent object keeps slighlty rotating/moving.
public class KeepJointRotation : MonoBehaviour {
Quaternion initRotation;
// Use this for initialization
void Start () {
initRotation = transform.localRotation;
}
// Update is called once per frame
void FixedUpdate () {
RotationUpdate();
}
void RotationUpdate()
{
float delta = Quaternion.Angle(transform.localRotation, initRotation);
if (delta > 1) {
transform.localRotation = initRotation;
}
}
}