Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Nandeep Mali |
I have setup a simple camera node and trying to rotate it by 90 degrees. As per the documentation:
rotate
method “Rotates the local transformation around axis, a unit Vector3, by specified angle in radians.”
This is my code:
func _ready(): print("Before rotate") print(transform.basis) print(global_transform.basis) rotate(Vector3.UP, deg2rad(90)) print("After rotate") print(transform.basis) print(global_transform.basis)
This is the output:
Before rotate ((1, 0, 0), (0, 1, 0), (0, 0, 1)) ((1, 0, 0), (0, 1, 0), (0, 0, 1)) After rotate ((-0, 0, 1), (0, 1, 0), (-1, 0, -0)) ((-0, 0, 1), (0, 1, 0), (-1, 0, -0))
I am not sure if I understand the concept of global transforms and local transform clearly because as per the documentation they contain two different transforms.
This is the same behavior with rotate_object_local
as well (but it shouldn’t matter because they both work with local transforms.