godot icon indicating copy to clipboard operation
godot copied to clipboard

C# Transform2D Rotated and RotatedLocal are interchanged

Open PhilWun opened this issue 2 years ago • 0 comments

Godot version

4.0-beta16

System information

Fedora 37

Issue description

In C# the methods Rotated and RotatedLocal from Transform2D seem to be interchanged. Rotated does a local rotation and RotatedLocal does a global rotation. In GDScript they do the correct thing.

Steps to reproduce

C# example code:

var test = new Transform2D(0, new Vector2(100, 100));
GD.Print("C#");
GD.Print(test);
GD.Print(test.Rotated((float) Math.PI));
GD.Print(test.RotatedLocal((float) Math.PI));

GDScript example code:

var test = Transform2D(0, Vector2(100, 100))
print("GDScript")
print(test)
print(test.rotated(PI))
print(test.rotated_local(PI))

Output:

C# [X: (1, 0), Y: (-0, 1), O: (100, 100)] [X: (-1, -8.742278E-08), Y: (8.742278E-08, -1), O: (100, 100)] [X: (-1, -8.742278E-08), Y: (8.742278E-08, -1), O: (-99.99999, -100.00001)] GDScript [X: (1, 0), Y: (0, 1), O: (100, 100)] [X: (-1, -0), Y: (0, -1), O: (-99.99999, -100)] [X: (-1, -0), Y: (0, -1), O: (100, 100)]

As you can see the two methods do in C# the opposite of what they do in GDScript.

Minimal reproduction project

RotateBug.zip

PhilWun avatar Jan 29 '23 17:01 PhilWun