- Home /
Getting a point in relation to an object with a different axis alignment
Let's say that I have a collection of points (Vector3's) that are in my game. I also have a player object. What I would like to do is take a "snapshot" of where those points are in relation to the player object, aligned such that the Z-axis is "away" from the player, the Y axis is "Up", etc.
I can use InverseTransformVector to get the "local space" coordinates of the Vector3's (as though they were the children of my object although they are not). However, that's only the first part of what I want because the X/Y/Z "axis" of the Vectors is still such that it's not aligned so that the Z axis is directly away from where the player is facing. How do I transform that Vector3 in local space to consider it from a different axis alignment?
In the simplest terms I can think to express, basically if I have a block that is located 1 foot in front of my face when I'm facing West, and then I turn around to the East and there is also a block 1 foot in front of my face, I want those two blocks to have the same "local" coordinates when I consider them, even though they have different world space coordinates, and they would have different coordinates locally if I considered them at the same time.
If anyone can just point me in the general direction of what to Google for to do this, it would be much appreciated.