Animation movement help

Hello, I made and animated a human model for my unity game. When i use it in unity, everything works well.
I just want to know how to make it so that if i look up, the top half of my body looks up. How might I go about doing this?

Use Inverse Kinematics. Add a small script that has an OnAnimatorIK method. In this method, use SetLookPosition and SetLookWeight.

The look position should be a transform (such as an empty GameObject) that specifies where the character should look. When you look up, move this GameObject up. Depending on your setup, you could do this by making the GameObject a child of the camera.

1 Like

Or something like this :

void OnAnimatorIK(int layerIndex)
{
   Vector3 TenFowardTheCenterOfTheScreen = new Vector3(0.5f, 0.5f, 10.0f);
   Vector3 lookTarget = Camera.main.ViewportToWorldPoint(TenFowardTheCenterOfTheScreen);
   MyAnimator.SetLookAtWeight(1.0f, 0.8f, 0.8f, 0.0f, 5.0f);
   MyAnimator.SetLookAtPosition (lookTarget);
}
1 Like

Thanks for the help! But I am completely new to the IK stuff so I cant get it to work