Skip to content

Commit

Permalink
RN gimbal constrain remove
Browse files Browse the repository at this point in the history
-Removed broken gimbal constrain as it prevents vernier engines from
working correctly. There is no practical reason to have this feature as
the values are set in the configuration files anyway.
  • Loading branch information
raidernick committed Nov 2, 2015
1 parent 30d65ec commit 321f4e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.4.0")]
[assembly: AssemblyFileVersion("3.0.4.0")]
[assembly: AssemblyVersion("3.0.5.0")]
[assembly: AssemblyFileVersion("3.0.5.0")]
23 changes: 3 additions & 20 deletions km_Gimbal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ public float TrimY
[KSPField(isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "CurrentRoll")]
private float currentRoll = 0;

[KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Limit gimbal"),
UI_FloatRange(minValue = 0f, maxValue = 14f, stepIncrement = 1f)]
public float gimbalConstrain = 14;

[KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Gimbal"),
UI_Toggle(disabledText = "Disabled", enabledText = "Enabled")]
public bool enableGimbal = true;
Expand Down Expand Up @@ -271,6 +267,7 @@ public override string GetInfo()
"KM Gimbal plugin by dtobi & sarbian";
}


public override void OnStart(StartState state)
{
Transform[] array = part.FindModelTransforms(gimbalTransformName);
Expand Down Expand Up @@ -319,19 +316,6 @@ public override void OnStart(StartState state)
trimYRange.maxValue = yawGimbalRange;
trimYRange.stepIncrement = yawGimbalRange >= 10f ? 1f : yawGimbalRange >= 5f ? 0.5f : 0.25f;


// Allow gimbalConstrain over 14.
BaseField field = Fields["gimbalConstrain"];
if (field != null)
{
UI_FloatRange range = (UI_FloatRange) field.uiControlEditor;
if (range != null)
{
if (gimbalConstrain > range.maxValue)
range.maxValue = gimbalConstrain;
}
}

if (state == StartState.Editor)
{
print("Roll is enabled?: " + enableRoll);
Expand Down Expand Up @@ -434,7 +418,6 @@ public override void OnUpdate()
}
part.force_activate();
}
print(gimbalConstrain.ToString("F1"));
}

public override void OnFixedUpdate()
Expand Down Expand Up @@ -484,8 +467,8 @@ private void updateFlight()

calcCounter++;

float maxPitchGimbalRange = Math.Min(pitchGimbalRange, gimbalConstrain);
float maxYawGimbalRange = Math.Min(yawGimbalRange, gimbalConstrain);
float maxPitchGimbalRange = pitchGimbalRange;
float maxYawGimbalRange = yawGimbalRange;

currentPitch = vessel.ctrlState.pitch * (invertPitch ? -1f : 1f);
currentYaw = vessel.ctrlState.yaw * (invertYaw ? -1f : 1f);
Expand Down

0 comments on commit 321f4e5

Please sign in to comment.