godotengine / godotengine/godot-docs
When you print a transform you are unexpectedy seeing its transpose
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
3.2.3-stable
**Issue description:**
I was trying to make a simple transform of a 90 degree rotation
> var a = Transform().rotated(Vector3(0,1,0), deg2rad(-90))
> print(a)
> \> -0, 0, -1, 0, 1, 0, 1, 0, -0 - 0, 0, 0
> print(a.basis.get_euler())
> \> (-0, -1.570796, 0)
> print(var2str(a))
> \> Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )
Radians are an abomination because there is no number whose cosine is zero. I wanted to use the proper rotation matrix, so I wrote:
> var b = Transform(Vector3(0,0,-1), Vector3(0,1,0), Vector3(1,0,0), Vector3(0,0,0))
> print(b)
> \> 0, 0, -1, 0, 1, 0, 1, 0, 0 - 0, 0, 0
> print(b.basis.get_euler())
> \> (-0, 1.570796, 0)
Not the same transform!
Here's the problem:
> var c = Transform(Vector3(1,2,3), Vector3(4,5,6), Vector3(7,8,9), Vector3(10,11,12))
> print(c)
> \> 1, 4, 7, 2, 5, 8, 3, 6, 9 - 10, 11, 12
This is the transpose presentation. It is too late to change this behavior, but it needs to be documented on the transform page because it is so unexpected when you go round printing these variables and then naively copying the numbers into a constructor. The constant transform constants on the documentation page happened to choose 3 transforms were symmetric.
This issue was noted in https://github.com/godotengine/godot-docs/issues/1353
**URL to the documentation page:**
https://docs.godotengine.org/en/stable/classes/class_transform.html?highlight=transform#constants
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.