Need help rotating
Hi I am making a space shooter and need my enemies to turn towards the player. How do I do that I know how to get the angle and to rotate but cant figure out how to stop when facing the player.
Stop rotating when the angle between the enemy craft and the player gets close to zero. One way to do this is to interpolate your rotation over time.
neneboricua
neneboricua
I'd try doing a comparison of two vectors: the direction that the enemy ship is currently facing, and the direction from the enemy ship to the player. ( ie: initial, final ).
As you rotate towards final, do some sort of comparison that seems appropriate.
if ( (current vieWVectorDimensions - final ViewVectorDimensions) < acceptableDimensionDifference )
{
stopTurning
}
else
{
recalculate turning axis, turn more, loop again
}
Is that reasonable?
Mike
As you rotate towards final, do some sort of comparison that seems appropriate.
if ( (current vieWVectorDimensions - final ViewVectorDimensions) < acceptableDimensionDifference )
{
stopTurning
}
else
{
recalculate turning axis, turn more, loop again
}
Is that reasonable?
Mike
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement