Search Unity

Help Wanted Editing animation position in-engine

Discussion in 'Animation' started by ThomasFaretra, Aug 12, 2021.

  1. ThomasFaretra

    ThomasFaretra

    Joined:
    Jun 9, 2021
    Posts:
    3
    I've been doing some sprite animation, which I am very new too, and I've run into the issue that when I add animations that shift the centre of the animation (I.E. a stab which extends away from the player's centre) the animation looks like the player is shifting backwards due to the animation being centred on the centre of the player object.

    I'm not sure I'm explaining myself well, so I'll attach a small diagram I whipped up to help explain the issue.

    Am I just doing animation wrong?

    Thanks in advance.
     

    Attached Files:

  2. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    233
    Hey,

    I don't actually animate with sprites, so I haven't tested this, but I'm pretty sure editing the pivot position of the problem sprite will solve this issue.

    Go into the Sprite Editor, and change the problem sprite's pivot position (blue circle) to match the other sprites. So for your example, you would just need to move the pivot to the center of the character's body for the stab sprite.

    This is one solution, but what I mainly see people doing is giving each sprite identical space (like a 32x32 box for example), so that the pivots make sense by default. This does require some extra forethought though.
     
    Ted_Wikman likes this.
unityunity