So I have code which spawns out a room in a given direction and my code works but only for positive directions of X or Y.
What I am struggling with is how to get the left and right of another vector, assuming that other vector is forward.
For example, the left and right of (0,0,1) are (-1,0,0) and (1,0,0)
The left and right of (1,0,0) are (0,0,-1) and (0,0,1)
I tried something like subtraction, since I am iterating to the left and right,
Vector3 unadjustedPos = new Vector3(1,0,1);
Vector3 unadjustedNeg = new Vector3(-1,0,-1);
Vector3 adjustedPosDir = unadjustedPos - direction;
Vector3 adjustedNegDir = unadjustedNeg + direction;
but again this only works for positive directions of X and Z. At this moment I am not concerned about the Y direction, assuming that is always 0.
So again - given a directional vector (0,0,-1) or any vector, how can I find the left and right positional vectors? I feel like I am missing a builtin or something with simple maths…
Thank you.