In order to implement intelligent steering behaviours, we need a way to know which way to turn.
I used this code as the basis for steering,
/// Calculate signed angle between two vectors - needed for AI steering behaviours!
float SignedAngle(Vector3 from, Vector3 to, Vector3 upVector)
{
float unsignedAngle = from.Angle(to);
float sign = upVector.DotProduct(from.CrossProduct(to));
if(sign<0)
unsignedAngle = -unsignedAngle;
return unsignedAngle;
}
Yell if it dont werk, I’ll fix the post, it will be so.