Skip to content

Commit bf1d731

Browse files
committed
Fix useThrottle (thanks @Starwaster for finding the bug!)
1 parent d1eda44 commit bf1d731

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Source/ModuleRCSFX.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,14 @@ public override void OnStart(StartState state)
157157
if (this.part.vessel == null)
158158
return;
159159

160-
inputLinear = vessel.ReferenceTransform.rotation * new Vector3(enableX ? vessel.ctrlState.X : 0f, enableZ ? vessel.ctrlState.Z : 0f, enableY ? vessel.ctrlState.Y : 0f);
161-
inputAngular = vessel.ReferenceTransform.rotation * new Vector3(enablePitch ? vessel.ctrlState.pitch : 0f, enableRoll ? vessel.ctrlState.roll : 0f, enableYaw ? vessel.ctrlState.yaw : 0);
160+
float ctrlZ = vessel.ctrlState.Z;
162161
if (useThrottle)
163162
{
164-
inputLinear.y -= vessel.ctrlState.mainThrottle;
165-
inputLinear.y = Mathf.Clamp(inputLinear.y, -1f, 1f);
163+
ctrlZ -= vessel.ctrlState.mainThrottle;
164+
ctrlZ = Mathf.Clamp(ctrlZ, -1f, 1f);
166165
}
166+
inputLinear = vessel.ReferenceTransform.rotation * new Vector3(enableX ? vessel.ctrlState.X : 0f, enableZ ? ctrlZ : 0f, enableY ? vessel.ctrlState.Y : 0f);
167+
inputAngular = vessel.ReferenceTransform.rotation * new Vector3(enablePitch ? vessel.ctrlState.pitch : 0f, enableRoll ? vessel.ctrlState.roll : 0f, enableYaw ? vessel.ctrlState.yaw : 0);
167168

168169
// Epsilon checks (min values)
169170
float EPSILON2 = EPSILON * EPSILON;

0 commit comments

Comments
 (0)