I have a character animated by mecanim, using root motion for movement. I’m trying to attach a ponytail to the character’s head, but it seems to be out of synch with the mecanim movement. I made the ponytail as 5 rigidbody boxes, connected to each other with configurable joints. The position motions are set to Locked, so that the joints only allow rotation. The ponytail setup itself works well.
In order to attach it to the mecanim character, I added a kinematic rigidbody to the character’s head, and set the animator to animate physics. I then used another configurable joint to attach the start of the ponytail to the character’s head.
The ponytail now kind of follows the character. The problem is that when I run around, the ponytail lags behind. Basically floating 10 cm behind the head if the character is walking, and the distance increasing to maybe 30-40cm if the character is running.
Just as a test, I also made a separate “attachment Head” which was a kinematic rigidbody that I forced to follow the mecanim head by using rigidBody.SetPosition(headTransform.position) and the same function for rotation inside FixedUpdate(). This object was also unable to synch up with the mecanim object, floating behind it.
Finally, I just tried to force the transform.position and rotation of a separate object to be the same as the mecanim head, each LateUpdate(). This worked, but it kind of just offsets the problem since a physical object is unable to follow that object anyway.
What is the correct way to attach a physical object to a mecanim character?