Hello,
First time posting so I hope I’m providing sufficient details about the issue I’m facing.
I’m working on an active ragdoll character with multiple configurable joints, using XYZ position spring values to stay in place. The character’s limbs also mimic the rotations of a separate, animated version of the same character model.
Now I’m trying to add the functionality for the ragdoll’s hands to grab specific objects. I do this by adding a configurable joint to the grabbed object and set its connected body to the rigidbody of the hand. Here is the method used to do this:
private void OnCollisionEnter(Collision col)
{
Grabbable grabbable = col.collider.GetComponent<Grabbable>();
if (grabbable && !grabbedObject && Input.GetMouseButton(grabButton))
{
this.grabbedObject = grabbable;
grabbedObjectCollider = col.collider;
Physics.IgnoreCollision(myCollider, grabbedObjectCollider, true);
grabJoint = grabbable.gameObject.AddComponent<ConfigurableJoint>();
grabJoint.connectedBody = this.myRB;
grabJoint.breakForce = this.grabStrength;
grabJoint.xMotion = ConfigurableJointMotion.Locked;
grabJoint.yMotion = ConfigurableJointMotion.Locked;
grabJoint.zMotion = ConfigurableJointMotion.Locked;
grabJoint.angularXMotion = ConfigurableJointMotion.Locked;
grabJoint.angularYMotion = ConfigurableJointMotion.Locked;
grabJoint.angularZMotion = ConfigurableJointMotion.Locked;
StartCoroutine(WaitForGrabRelease());
}
}
However this causes very unpredictable results. Objects that are grabbed sometimes spazz out. Other times the ragdoll spazzes out. And every now and then it seems to work. Generally it appears that objects with a higher mass value tend to be more problematic.
Here are a few examples of what happens:
I have read up on similar problems, though I cannot seem to find a workaround or explanation of what might be the culprit.
Is there something specific that stands out in this scenario which could cause these kinds of problems?
Would be happy to provide additional details if necessary.