Advanced Animation Techniques for networked games

alt text

As you can see in the image above, the players torso is aiming downwards. This is because the player is aiming down. How can this be done in Unity? I can get the player to do different animations over a network - but as the player aims the rotation of the torso/arms wont change (obviously). Do I need to split the mesh into 2 parts?

You don’t need to use animation. Just reference the bone transform (probably the Spine/Torso bone) of the model from your rig, then rotate it (boneTransform.localEulerAngles) based on mouse movement.

You will want to do it in LateUpdate.

You can even see it in-editor without playing. Just select the bone and rotate it and the skinnedmesh should follow.

public Transform bone;
public Vector3 boneTargetV;

void LateUpdate()
{
	boneTargetV += new Vector3(-Input.GetAxis("Mouse X"), -Input.GetAxis("Mouse Y"));

	bone.localEulerAngles = boneTargetV;
}