0 votes

So, for the game I'm working on, given a high degree of precision to the graphics, everything moves and animates better with pixel snapping at 1080p and 4K resolutions, but with all other resolutions they move and animate better without pixel snapping. However, changing the pixel snapping setting at run-time based on the current window/display resolution like this:

ProjectSettings.set_setting("rendering/2d/snapping/use_gpu_pixel_snap",true)

...doesn't work. Going from a default state of false to true or a default state of true to false doesn't make a difference; changing the setting is not actually adjusting how this works at run-time. So... how do I ACTUALLY adjust this at run-time?

Godot version 3.4.2.stable.official
in Engine by (27 points)

1 Answer

0 votes

So, I ran into this while trying to figure out how to do it in godot 4(alpha 14). I tested it in 3 and I don't think the solution is the same, but it might get you or someone else on the right path. This is how you do it in 4:

get_viewport().snap_2d_transforms_to_pixel = bool

So it might be somewhere in the window/viewport settings.

by (16 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.