Rotation problems when I child a sword to players hand! (pictures within to clarify)

First, observe this image of the shoulder rotating correctly. It rotates properly along the joint, but the sword doesn’t stay in his hand, because it is not a child of the hand:

[14366-correct+rotation.png|14366]

now, I child the sword to the hand, so now the shoulder should rotate and the sword should stay in the hand, right? Not quite:

[14367-bad+rotation.png|14367]

now for some reason, the shoulder pivots around the sword instead of the chest!

What’s going on!?

The sword is being interpreted as part of your bone structure, and so interfering with your animations.

I’ve had this problem in the past, and I’ve worked around it by doing this:

Make an empty game object. Make the sword a child of that object, and orient it so that the hilt is at the “center” of the empty object.

On the empty object, place a script that updates its location like so:

public Transform target;



void Update()
{
    transform.position = target.position;
}

then drop the transform of the hand onto the “target” variable in the inspector for this game object. The game object will now lock to position wherever the hand is. you can adjust the location of the sword by moving it around in local space, relative to the parent object.

if you want it to follow rotation, you can add the line:

transform.rotation = target.rotation;