Animation Positions

Hey I am making a game where the player has to press the buttons on the sides to play the animation of the character moving to the lane next to him, like subway surfers. The problem is hat whenever I play the animations, it just starts from back in the middle of the lane, and not from the side or where it was. Pretty much I would be on the side lane, and I would press the button to go left again, and it will go right back into the middle lane and repeat the animation, never moving to the left.

This is worded horribly but hopefully you can understand.

Thanks!

Hi,
i did something similar by:

  1. building an animator that has all
    the animations the character can
    have.
  2. then i added triggers to
    each of the animators
  3. the
    triggers are triggered from the code
    (e.g.: when pressing one of your
    buttons)

two key points:

  • the animations are IN PLACE. so inside the animation, the character position doesn’t change
  • the position of the character is changed from the code, not from the animation.
    by doing both at the same time, the effect is that the player is for example jumping to the right, but what we are really doing is jumping in the same position (animation) and moving the whole object to the right.

hope i understood the issue and the solution is helpful

hope that helps.