+1 vote

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.

in Engine by (13 points)

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.

2 Answers

0 votes

turn on pixel snap in settings i think will fix it
https://alvarber.gitlab.io/pixel-perfection-in-godot.html

by (1,884 points)
0 votes

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.
by (371 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.