You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In C# Vector2I conversion produces inconsistent rounding behavior. GD.PrintS((Vector2I)(new Vector2(0.5f, 0.51f)), (int)(0.5f), (int)(0.51f)); will print (0, 1) 0 0 (note that y component is rounded to 1). On the other hand, such conversion in GDScript produces consistent result, both print(Vector2i(0.5, 0.51)) and print(Vector2i(Vector2(0.5, 0.51))) will output (0, 0).
It looks like Vector2I conversion in C# uses Round() instead of Truncate() (taking into account negative values).
Steps to reproduce
Run following codes in C#: GD.PrintS((Vector2I)(new Vector2(0.5f, 0.51f)), (int)(0.5f), (int)(0.51f));
and GDScript: print(Vector2i(0.5, 0.51)) and print(Vector2i(Vector2(0.5, 0.51)))
then compare results.
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered:
It seems like this is due to the inconsistent behaviors between the rounding behaviors of the Vector2I conversion for C# and GDScript. We can try to use same rounding method in both languages and see if we can fix the problem.
Godot version
v4.0.1.stable.mono.official
System information
Windows 10
Issue description
In C# Vector2I conversion produces inconsistent rounding behavior.
GD.PrintS((Vector2I)(new Vector2(0.5f, 0.51f)), (int)(0.5f), (int)(0.51f));
will print(0, 1) 0 0
(note that y component is rounded to 1). On the other hand, such conversion in GDScript produces consistent result, bothprint(Vector2i(0.5, 0.51))
andprint(Vector2i(Vector2(0.5, 0.51)))
will output(0, 0)
.It looks like Vector2I conversion in C# uses Round() instead of Truncate() (taking into account negative values).
Steps to reproduce
Run following codes in C#:
GD.PrintS((Vector2I)(new Vector2(0.5f, 0.51f)), (int)(0.5f), (int)(0.51f));
and GDScript:
print(Vector2i(0.5, 0.51))
andprint(Vector2i(Vector2(0.5, 0.51)))
then compare results.
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: