private void Rotate() { if (Data.RotationSpeed != 0) { MyQuaternion rotationToTarget = MyQuaternion.LookRotation(Data.RotationTarget - Data.Position); //removeing z axis rotationToTarget = MyQuaternion.Euler(rotationToTarget.eulerAngles.x, rotationToTarget.eulerAngles.y, Data.Rotation.eulerAngles.z); Data.Rotation = MyQuaternion.RotateTowards(Data.Rotation, rotationToTarget, Data.RotationSpeed); } }
private void Rotate() { if (TargetToMove != null) { MyQuaternion rotationToTarget = MyQuaternion.LookRotation(TargetToMove.Position - p.Position); //removeing z axis rotationToTarget = MyQuaternion.Euler(rotationToTarget.eulerAngles.x, rotationToTarget.eulerAngles.y, zBeforeRotation); if (p.Rotation != rotationToTarget) { p.Rotation = MyQuaternion.RotateTowards(p.Rotation, rotationToTarget, p.RotationSpeed * TickDeltaTime / 1000f); Console.WriteLine("Ship {0} , rotation {1} target {2} rotation to target {3}", p.Id, p.Rotation.eulerAngles, TargetToMove.Id, rotationToTarget.eulerAngles); } } }