Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

IK Aiming help

Discussion in 'Animation' started by Laguna_Seca, Aug 7, 2018.

  1. Laguna_Seca


    Mar 13, 2014
    [Sorry for my bad english.]
    I've already spent a lot of time trying to solve this problem. I need the skeleton of the character to rotate down / up following the crosshair.

    When I'm using SetLookAtPosition, my character puts his hands to the left and up.

    Code (CSharp):
    2. animator.SetLookAtWeight(1, 1f, 1f, 1);
    3. animator.SetLookAtPosition(cameraLookPoint.position);
    12.png 13.png

    I want to watch it should be at the point in the center of the camera.
    How is this problem solved? My animation without IK is direct and has no deviations. IK breaks animation.
  2. Mecanim-Dev


    Unity Technologies

    Nov 26, 2012
    A LookAt is not an AimAt.

    a look at will align the forward vector(Z axis) of a transform toward a target.
    the animator built in look at does affect the chest, neck, head and eyes. So it really hard to align the gun on a target by changing the rotation of thoses 4 transforms, the only one really affecting the alignement on the gun is the chest.

    The basic idea is to align the forward vector of the gun toward the target and then apply IK on the hands to reach the gun. Some game adjust the position of the character first to avoid any weird pose too.