there is something wrong with this, it’s not rotating by 90 degrees or something.
Is there a better way to rotate the unit vector so it’s at 90 degrees to the first vector?
When you Debug.Log(rotatedVector), what is the result? It seems to me that that should work correctly. (I would expect the result to be (0,0,1), give or take a little floating point inaccuracy.)
Sorry, I wrote this free hand without refering to my code, it’s actually Vector3.left
The quaternion returned is {(0.7071, 0.0, 0.0, 0.7071)} and the rotatedVector comes out as -1,0,0 same as the unitVector
So… you’re rotating a vector that’s pointing left, around an axis that’s pointing left? Of course that’s going to be the same result. It’s like having a stick pointing upwards at the North Pole - it’s always gonna face the same direction.
So what would you use to get a rotated unit vector lets say (0.7,-0.5,0.3); what would you use to get a 90 degree angle? my example was a bit messed up as you pointed out.
That’s kind of my issue, the totalDirection is different each time and what it needs to rotate around isn’t one of the predefined values available, if that makes sense.
You have kind of helped already, i think i know how i can fix it, if i randomise position in the x and z i can rotate around the up then… That might have been internal muttering, but basically the total direction is the vector between this object and the origin. and it’s currently created at a random position in the x y and z if i don’t randomise the y i can surely rotate it around the up vector then?