public static void SmoothMoveToAgent(MissionScreen missionScreen, bool forceMove = false, bool changeCameraRotation = true) { try { var spectatingData = missionScreen.GetSpectatingData(missionScreen.CombatCamera.Position); if (spectatingData.AgentToFollow != null) { CameraAddSpecialMovement?.SetValue(missionScreen, true); CameraApplySpecialMovementsInstantly?.SetValue(missionScreen, false); if (missionScreen.LastFollowedAgent != spectatingData.AgentToFollow || forceMove) { var targetFrame = GetCameraFrameWhenLockedToAgent(missionScreen, spectatingData.AgentToFollow); CameraSpecialCurrentPositionToAdd?.SetValue(missionScreen, missionScreen.CombatCamera.Position - targetFrame.origin); } if (changeCameraRotation) { CameraSpecialCurrentAddedElevation?.SetValue(missionScreen, missionScreen.CameraElevation); CameraSpecialCurrentAddedBearing?.SetValue(missionScreen, MBMath.WrapAngle(missionScreen.CameraBearing - spectatingData.AgentToFollow.LookDirectionAsAngle)); SetCameraElevation?.Invoke(missionScreen, new object[] { 0.0f }); SetCameraBearing?.Invoke(missionScreen, new object[] { spectatingData.AgentToFollow.LookDirectionAsAngle }); } SetLastFollowedAgent.Invoke(missionScreen, new object[] { spectatingData.AgentToFollow }); } // Avoid MissionScreen._cameraSpecialCurrentAddedBearing reset to 0. SetIsPlayerAgentAdded(missionScreen, false); } catch (Exception e) { Console.WriteLine(e); } }