Transform.basis seems wrong way around ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By siska

I was reading the Godot documentation trying to understand 3d rotations.
I made a test scene where the yellow prism is rotated 90 degrees in the editor. I then printed the transform basis :

The code I used is this :

var loc_transf = $"../Camera_Mark3".transform
print(loc_transf.basis)

The result was :

((-0, 0, 1), (0, 1, 0), (-1, 0, -0))

… which seems like the wrong way around ??? It seems to me that the local X axis of the yellow prism is facing towards the negative Z, so it should be (0,0,-1). Same thing for the local Z-axis ; it faces in the direction of the positive X, so it should be (+1,0,0) ?

:bust_in_silhouette: Reply From: Zylann

Basis storage is transposed, but if you use the .x, .y and .z accessors you will get the same axes you see in the editor.
See Document why Basis axis vectors are exposed transposed · Issue #26432 · godotengine/godot · GitHub

Thanks for the link ! I understand now.

Maybe the documentation should mention this … I’m sure others will be confused as well.

siska | 2019-03-13 16:31