Topic was automatically imported from the old Question2Answer platform.
Asked By
StormFalcon32
I’ve been reading the docs and (once again) I cannot find a method that returns a vector3 representing the direction a spatial node is facing. I was trying to use get_global_transform().basis, but apparently that doesn’t return a vector3? How can I find a Vector3 representing the facing direction of an object?
There is no “official” forward direction. Which way is forward depends on how you built your mesh. So if you want the foward direction in global coordinates you’ll have to use get_global_transform().basis.x, get_global_transform().basis.y or get_global_transform().basis.z, depending on which direction is supposed to be forward.
Don’t get confused by the names: the basis is a matrix, and a matrix is a set of factors that are applied to the x-, y- and z-component of a vector that is multiplied with that matrix. So basis.x is the factor for the x-component, and that factor is a Vector3.