I know this is quite a dumb question. But why isit that the Z axis is the value to pass in for the IntentTurnRight() function. From my understanding the cross product is a vector that is perpendicular to the 2 vector TankForward and AIForwardIntention. Why isit that using the Z value of the new vector will result the tank to rotate towards the player direction.
We are just thinking of the time turns in terms of a rotation around the Z axis, does that help?
Thanks for the reply.
Ah, so we are just thinking the amount of rotation around the Z axis. In another words the value of Z is the new position of a perpendicular vector.
But also the value is the amount we need to turn the tank to have the “TankForward” align with “AIForwardIntention” value.
After trying out on a cross product calculator. I think i see the relationship.
e.g
X means Cross Product Function
(1,1,1) X (1,1,1) = (0,0,0)
(1,2,1) X (1,1,1) = (1,0,-1) <— the Z is -1 hence we need to turn -1 on the Z axis. So that both the forward and turn right vector can align.
( 1,3,1) X (1,1,1) = ( 2,0,-2) <-- the Z is -2 hence we need to turn -2 on the Z axis. So that both the forward and turn right vector can align.
Please let me know if I am still not understanding it correctly.
I wrote a post about a similar concept, I don’t know if it helps: