Search Unity

How to face back?

Discussion in 'Animation' started by KingSley167, Dec 20, 2018.

  1. KingSley167

    KingSley167

    Joined:
    Dec 11, 2018
    Posts:
    2
    I watched this guy's tutorial (
    )
    And than I try to make it myself, and I only make the characters turn right and left. And now I get a problem my character always face back to left, my "LastMoveX" didn't reset to 0 so that it didn't turn back.
    Can any one teach me how to fix it?

    All the Animation's set, coding are same as the tutorial video, I just I make the character can only move left and right.
     
  2. knobblez

    knobblez

    Joined:
    Nov 26, 2017
    Posts:
    223
    This guy made left and right animations which are not necessary if the animations are the same(idk if his are or not). You can flip an animation by changing the X scale from 1 to -1 and vice versa. As for the LastMoveX not resetting to 0, you can do that from your player movement script. If no movement keys are down then set LastMoveX and LastMoveY to 0. If your issue is that when you move 'left' and then move 'up', your player still shows 'left'. You can fix this by setting LastMoveX to 0 when a vertical movement key is pressed(same for LastMoveY when a horizontal movement key is pressed).

    I'm guessing at what you mean because I'm not gonna watch a 20 min video just to learn about your problem. No offense, i just don't have time for that.
     
    KingSley167 likes this.