You have an entity A that you want to turn towards another entity B. One way to determine the direction to turn is to compute the cross-product of the direction vector of A with the vector from AB. If the value of z is positive, then you turn right. If the value of z is negative, you turn left. Is this the only way of determining which way to turn?
Answer
If you're storing your rotations as quaternions (which you probably should), you could use a quaternion lerp function to lerp from your initial rotation to the rotation you want to be at (i.e the rotation given by the vector AB with whatever your up vector is).
No comments:
Post a Comment