-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Tilemap editor adds extra pixel for odd numbered tile resolutions #87138
Comments
There are indeed truncations of floats to ints in few places resulting in incorrect offsets, PR fixing these incoming. AFAICT these affect only the debug drawing though. What's a bigger problem is that Specifically here: godot/editor/plugins/tiles/tile_data_editors.cpp Lines 2831 to 2843 in 26b1fd0
for a single outline [(-2.5, -2.5), (2.5, -2.5), (2.5, 2.5), (-2.5, 2.5)] it produces a navigation polygon with vertices [(3.0, 3.0), (-3.0, 3.0), (-3.0, -3.0), (3.0, -3.0)] (a single polygon with indices [0, 1, 2, 3] ).
More specifically the rounding happens here when converting godot/modules/navigation/nav_mesh_generator_2d.cpp Lines 742 to 745 in 26b1fd0
godot/thirdparty/clipper2/include/clipper2/clipper.core.h Lines 165 to 166 in 26b1fd0
godot/thirdparty/clipper2/include/clipper2/clipper.core.h Lines 144 to 152 in 26b1fd0
|
That the 2D navigation mesh baking only works with integers and "full pixels" was a decision for performance and robustness. In my early tests That said that was a while ago so may be worth a retest with newer clipper versions if it is still such an issue using PointD. I really do not want to up and downscale the float positions manually like the old clipper1 required and Geometry2D still uses, that was very bad for performance. |
Fixed by #89929. |
Tested versions
Reproducible in Godot v4.2.1
System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated AMD Radeon RX 6700 XT (Advanced Micro Devices, Inc.; 31.0.23013.1023) - AMD Ryzen 5 5600 6-Core Processor (12 Threads)
Issue description
When adding a tilemap and setting layers with Reset to default tile shape, odd numbered tile resolutions like (9x9 and 5x5) have an additional pixel added which can mess with physics and navigation.
Steps to reproduce
Try adding a layer and pressing reset to default tile shape for any odd numbered resolution.
Minimal reproduction project (MRP)
TilemapTest - Copy.zip
The text was updated successfully, but these errors were encountered: