Does anyone know some good resource to really understand what is happening with these lines of code? I mean I understand it but I don’t really know how or why these things exist.
// Character orientation
if (_MoveDirection.Length() > 0.001)
{
_YawOrientation = MathUtil.RadiansToDegrees((float)Math.Atan2(-_MoveDirection.Z, _MoveDirection.X) + MathUtil.PiOverTwo);
}
Unit.Transform.Rotation = Quaternion.RotationYawPitchRoll(MathUtil.DegreesToRadians(_YawOrientation), 0, 0);