/// <summary> /// Stop movement and rotation of the controller. /// </summary> /// <param name="enableDampeners">If true, dampeners will be enabled. If false, they will not be toggled.</param> public void MoveAndRotateStop(bool enableDampeners = true) { if (enableDampeners) { SetDamping(true); } if (m_stopped) { Log.TraceLog("already stopped"); return; } Log.DebugLog("stopping movement and rotation, dampeners: " + enableDampeners); m_moveForceRatio = m_moveAccel = Vector3.Zero; StopRotate(); MyAPIGateway.Utilities.TryInvokeOnGameThread(() => { Block.Controller.MoveAndRotateStopped(); Thrust.ClearOverrides(); //m_gyro.ClearOverrides(); }); m_stopped = true; }
public void SetControl(bool enable) { if (Block.AutopilotControl != enable) { Log.DebugLog("setting control, AutopilotControl: " + Block.AutopilotControl + ", enable: " + enable); MyAPIGateway.Utilities.TryInvokeOnGameThread(() => { if (!enable) { Block.Controller.MoveAndRotateStopped(); Thrust.ClearOverrides(); //m_gyro.ClearOverrides(); } Block.AutopilotControl = enable; }); } }