Search Unity

Why the Glasses do not move along with the animation?

Discussion in 'Animation' started by zyonneo, Mar 5, 2019.

  1. zyonneo

    zyonneo

    Joined:
    Apr 13, 2018
    Posts:
    386
    Hi I have downloaded a model with animation.I downloaded a Cooling glasses for his face and added into the hierarchy where his eyes where.When he moves his face according to the walk animation the glasses dont move.What I am doing wrong here.

    Code (CSharp):
    1. void Update ()
    2.     {
    3.  
    4.  
    5.         if (Input.GetKey(KeyCode.W))
    6.         {
    7.             animator.SetBool("Walk", true);
    8.            // transform.Translate(new Vector3(0, 0, Move) * Time.deltaTime);
    9.         }
    10.         else  if (Input.GetKey(KeyCode.A))
    11.         {
    12.             animator.SetBool("Walk", true);
    13.             //transform.Translate(new Vector3( -Move,0, 0) * Time.deltaTime);
    14.         }
    15.         else if (Input.GetKey(KeyCode.S))
    16.         {
    17.             animator.SetBool("Walk", true);
    18.            // transform.Translate(new Vector3(0, 0, -Move) * Time.deltaTime);
    19.         }
    20.         else if (Input.GetKey(KeyCode.D))
    21.         {
    22.             animator.SetBool("Walk", true);
    23.            // transform.Translate(new Vector3( Move,0, 0) * Time.deltaTime);
    24.         }
    25.         else
    26.         {
    27.             animator.SetBool("Walk", false);
    28.         }
    29.  
    30.  
    31.     }
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    Show a screenshot of where in the hierarchy your glasses are, and where the character's head is. The glasses need to be nested into the character's hierarchy so that its parent is the head/skull bone, and not just floating at a point in space that is near the right place.
     
    zyonneo likes this.
  3. zyonneo

    zyonneo

    Joined:
    Apr 13, 2018
    Posts:
    386
     
  4. zyonneo

    zyonneo

    Joined:
    Apr 13, 2018
    Posts:
    386
    Cool Halley...Got it thanks