Search Unity

Values differents between animation and ingame

Discussion in 'Animation' started by AnKOu, Jan 18, 2017.

  1. AnKOu

    AnKOu

    Joined:
    Aug 30, 2013
    Posts:
    123
    Hello,

    I'm a creating a little looping animation where I modify the transform position of a gameobject child of a dummy.
    In the animation, I set the z position switching between -4.27 and -3

    When I test ingame, the z value of the transform switches between a near 0 value and ~3.27. I don't understand why the value isn't the one set in animation (despite the fact that the delta is good)

    Have you any ideas ?

    Thank you
     
  2. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    The animation will be relative to the parent. So, you are probably seeing the world coordinates in your transform, while the animation is changing the local coordinates.
     
  3. AnKOu

    AnKOu

    Joined:
    Aug 30, 2013
    Posts:
    123
    I am not supposed to see world coordinates. Coordinates in transform inspector and in animation are both local.
     
  4. AnKOu

    AnKOu

    Joined:
    Aug 30, 2013
    Posts:
    123
    Bump !

    I uplaoded two images.
    One shows the transform values when animated ingame .
    The other one shows the values in the animation panel on different keys.

    See ? Same delta between the values, but a difference of height.
     

    Attached Files:

  5. AnKOu

    AnKOu

    Joined:
    Aug 30, 2013
    Posts:
    123
    When I add a key in frame 0 whose position in 0, the animation play well. Is this a behaviour of the animation to consider the first frame as the real current transform position and overwrite the value set in the animation with the current one ? And then overwrite the key values in next frames accordingly ?
    Because this is what seems to happen but I don't understand the benefit of such a behaviour.

    I can't leave it like that because the animation is looping...