Problem to center an AnimatedSprite

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ExtraMobs

I am working with an AnimatedSprite and to make my life easier I am centralizing it with the “centered” property.

And I have a problem that I don’t know if it’s an engine bug, but the texture isn’t inside the rectangle, it’s 0.5 outside, and it only happens in the AnimatedSprite node.

enter image description here
Does anyone know how to fix this, because I don’t want to give up using AnimatedSprite because it’s easier to animate the character. And I thought, apparently, the position of the texture is being rounded ?? is this any configuration?

PS: The image resolution is 17x51.

very new to Godot myself but I would imagine that a centre line always lands between two pixles , your resolution is an odd number, 8 pixels will land on one side of centre and 9 on the other.

ArthurER | 2020-08-29 21:12

:bust_in_silhouette: Reply From: rakkarage

turn on pixel snap in settings i think will fix it

:bust_in_silhouette: Reply From: Jayman2000

It looks like this is a bug that will be fixed in Godot 4.0. In the mean time, here’s a workaround:

  1. Add an invisible row to the bottom of any frames to make their heights even.
  2. Add an invisible column to the left side of any frames to make their widths even.
  3. Add one to the AnimatedSprite’s X and Y to keep the frames centered.