Search code examples
unity-game-enginespriterigid-bodies

Unity - 2D Having a sprites FEET land on the clicked position rather than the sprites center


I have my movement script figured out and my sprite is moving to the desired location (touch/mouse click location). The only problem I'm running into is that I rather have the sprites feet be the item that lands on the location rather than the center of the sprite. The below image illustrates what I'm running into. The red circled area is currently how the behavior of my sprite acts when I click a location (star symbol). I would like the green circled feet to end on the star location but I'm unsure how I can change that.

Current Movement

Object (Sprite) reference:

Object Reference


Solution

  • You can use the texture import settings to change the pivot of your sprite so it's at the bottom. This way the bottom of the sprite will always like up with the coordinates of your Transform component.