I have a problem with my XNA Game, I have a function where I need my sprite to face towards an enemy, using this code:
Vector2 currentPosition = Position;
Vector2 nearestEnemy = gameObjectManager.GetNearestEnemy(Position, GameObjectTypes.Zombie);
Orientation = (float)Math.Atan2(nearestEnemy.Y - currentPosition.Y, nearestEnemy.X - currentPosition.X)
As found on an XNA forum results in my character looking 90 degrees away from the enemy.
Adding "MathHelper.ToRadians(90);" to the end of my Orientation assignment fixes this bug, why is this happening?
Thanks!