Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

IK Aiming help

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

  1. Laguna_Seca

    Laguna_Seca

    Joined:
    Mar 13, 2014
    Posts:
    44
    [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):
    1.  
    2. animator.SetLookAtWeight(1, 1f, 1f, 1);
    3. animator.SetLookAtPosition(cameraLookPoint.position);
    4.  
    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

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,611
    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.