-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small question, do ALL canvas only support floats for XY(Z) positioning, widths, etc. #4480
Comments
Vector2i and Vector3i are only available in Also, yes, floating-point canvas coordinates are allowed. |
@Calinou How does godot render between-pixels? Unless it simply rounds downwards. Good thing these precision loss will only occur far offscreen (no monitors would have 2^52 or 2^23 number of pixels wide and tall) |
By default, it doesn't attempt to round pixel coordinates. This means things can move smoothly on screen, but it'll also make things blurrier. You can enable pixel snap in the Project Settings to make sure all pixel transforms are snapped before rendering. |
@Calinou So Godot actually supports displaying “sub-pixels”. Cool. |
No, as Controls are snapped to pixels by default, even if the properties themselves allow floating-point values. You can disable this by unchecking Snap Controls To Pixels in the Project Settings. If you disable Snap Controls To Pixels, text and other UI elements will be able to move to sub-pixel positions but will become less crisp. |
@Calinou Ack, that last sentence was a fragment, I was meant to say: “Also, according to this, will many other things related to textures being drawn, such as controls's properties (margin, size, position, global position etc.) support integer?” One last question: When pixel snapping is turned on, does internally that they're handled as ints (if you set it to a fractional value, it rounds into a whole number upon type conversion)? This is in case if you are reading the position of a rectangle after setting it to X=0.5 and it returns 0. |
I don't remember, but the way transforms are snapped was revised for 3.2.4 in godotengine/godot#43554. 3.2.3 still uses the old transform snapping code. |
I check out the canvas documentations and it seems that only floating point are supported, despite Vector2i and Vector3i exists. For vector2i, the units are in pixels, not sure if godot allows values to be halfway between pixels.
The text was updated successfully, but these errors were encountered: