How to anchor a sprite to the ground?

I have a sprite that I’m working on doing the animation for it right now. I am running into an issue where when the sprite changes animations to bend it’s knees the overall sprite becomes smaller. The problem is that the sprite seems to be set to the center of the game object which results in the legs of the character lifting off the ground. Is there a way to set it so that the bottom edge of the sprite is anchored to a point on the ground so when the sprite shrinks the feet stay on the ground?

Sorry about the wording I can’t think of a way to explain the issue more clearly.

@abrinck I had the same problem, but i changed my sprites in the sprite editor so that every frame is the same size. When doing that, the center of each frame is the same, so the animation is like wanted.

You can either do a raycast downwards from the sriptes pivotpoint and set the sprites position the the raycasts hit plus the height of the sprite divided by two, or simply change the sprites pivot point in the sprite editor.

The second option is undoubtedly the correct answer, hower the first method is quite helpfull for aligning things with the ground via script and i thought id mention it.