public static void TogglePausePhysics() { if (currentPhysicsCommand != null) { currentPhysicsCommand.Stop(); currentPhysicsCommand = null; return; } currentPhysicsCommand = new PhysicsPauseCommand(0); MonkeyEditorUtils.AddSceneCommand(currentPhysicsCommand); }
public static void PausePhysicsDuration( [CommandParameter(Help = "The duration for which the physics will be paused")] float duration = 5) { if (currentPhysicsCommand != null) { if (Mathf.Approximately(duration, 0)) { currentPhysicsCommand.Stop(); } else { currentPhysicsCommand.Duration = duration; currentPhysicsCommand.CurrentTime = 0; } return; } currentPhysicsCommand = new PhysicsPauseCommand(duration); MonkeyEditorUtils.AddSceneCommand(currentPhysicsCommand); }