how to get a 3d spatial node's global rotation?

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

I want to get a spatial node’s global rotation only, but not the scale

I have tried global_transmform.basis, but it contains the scale information.

so how can I get the rotation only?

Thank you.

:bust_in_silhouette: Reply From: Zylann

If you want the rotation as euler angles (in radians):

var rotation = global_transform.basis.get_euler()

If you want the rotation as a quaternion:

var rotation = Quat(global_transform.basis)

Thank you. I get it

icqqq | 2018-10-31 03:19