- Home /
Question by
MikeHergaarden · Mar 20, 2015 at 11:26 AM ·
rigidbodycharacterjoint
It is illegal for a joint to connect a rigid body to itself. UnityEngine.Joint:set_connectedBody(Rigidbody)
Although I figured this out, I'll post the answer here to help other save a few minutes
How can I add CharacterJoint at runtime and assign it a rigidbody? This error comes up but how else should a rigidbody be assigned?
//We have a rigidbody on this gameobject CharacterJoint j = gameObject.AddComponent(); j.connectedBody = r;
Comment
Answer by MikeHergaarden · Mar 20, 2015 at 04:46 PM
The characterjoint is always linking to a rigidbody on another gameobject (parent/child/whatever). The characterjoint may indeed not connect to the GO's rigidody itself since that it what it represents itself. The connectedBody must be an outside connection.