I have a vector that is defined in the local space of one object and I'm trying to figure out how to transform it into another objects's local space (ie, what direction is the camera's basis.z vector pointing from my player character's point of view?). Mathematically this should be pretty straight forward - in pseudo code, I would just need to solve:
remapMatrix = player.localToWorldMatrix.inverse() * camera.localToWorldMatrix
relativeDir = remapMatrix.vectorTransform(camera.transform.basis.z)
The trouble is, I cannot find any equivlents of get_local_to_world_matrix()
or vector_transform()
in the Godot API docs (a vector transform is different from a point transform - a vector transform ignores the origin of the transform matrix).
How would I do this in Godot?