Skip to content

Commit

Permalink
Principia compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-Bertholet committed Aug 20, 2023
1 parent de3fcf0 commit be0e2d8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Firespitter/aero/FSbladeLiftSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ public void FixedUpdate()

Vector3 liftVector = getLiftVector();

commonRigidBody.AddForceAtPosition(liftVector, liftTransform.position);
part.AddForceAtPosition(liftVector, liftTransform.position);

commonRigidBody.AddForceAtPosition(liftAndDrag.y * dragMultiplier * -commonRigidBody.GetPointVelocity(liftTransform.position).normalized, liftTransform.position);
part.AddForceAtPosition(liftAndDrag.y * dragMultiplier * -commonRigidBody.GetPointVelocity(liftTransform.position).normalized, liftTransform.position);
}
catch (Exception e)
{
Expand Down
4 changes: 2 additions & 2 deletions Firespitter/aero/FSliftSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public void FixedUpdate()
Vector3 liftVector = getLiftVector();

//Vector3 liftVector = liftAndDrag.x * -liftTransform.up;
commonRigidBody.AddForceAtPosition(liftVector, liftTransform.position);
part.AddForceAtPosition(liftVector, liftTransform.position);

commonRigidBody.AddForceAtPosition(liftAndDrag.y * dragMultiplier * -commonRigidBody.GetPointVelocity(liftTransform.position).normalized, liftTransform.position);
part.AddForceAtPosition(liftAndDrag.y * dragMultiplier * -commonRigidBody.GetPointVelocity(liftTransform.position).normalized, liftTransform.position);
}

public override void OnUpdate()
Expand Down
2 changes: 1 addition & 1 deletion Firespitter/engine/FS engine modules/FSengine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private void HandleFixedUpdate()

for (int i = 0; i < thrustTransforms.Length; i++)
{
GetComponent<Rigidbody>().AddForceAtPosition(-thrustTransforms[i].forward * applyThrust, thrustTransforms[i].position);
part.AddForceAtPosition(-thrustTransforms[i].forward * applyThrust, thrustTransforms[i].position);
}
smoothFxThrust = Mathf.Lerp(smoothFxThrust, finalThrustNormalized, smoothFXSpeed);

Expand Down
4 changes: 2 additions & 2 deletions Firespitter/engine/FSvelocityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public override void OnFixedUpdate()
if (!resourceReceived)
thrustUsed = 0f;
if (thrustUsed > 0f)
part.gameObject.GetComponent<Rigidbody>().AddForceAtPosition(finalThrust, t.transform.position);
part.AddForceAtPosition(finalThrust, t.transform.position);
//KSP 1.8
//if (useFX)
//{
Expand Down Expand Up @@ -157,7 +157,7 @@ private float updateThruster(int fxNumber, bool doThrust, Transform t)
if (thrustModifier > 0f && velocityDirection.magnitude > minVelocityToActivate)
{
finalThrust = -thrustDirection * thrustModifier * maxThrust;
//part.gameObject.GetComponent<Rigidbody>().AddForceAtPosition(-thrustDirection * thrustModifier * maxThrust, t.transform.position);
//part.AddForceAtPosition(-thrustDirection * thrustModifier * maxThrust, t.transform.position);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Firespitter/water/FSrudder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void FixedUpdate()
transformDirection = -transform.forward;
break;
}
base.GetComponent<Rigidbody>().AddForceAtPosition(transformDirection * forcetoAdd, base.transform.position);
base.AddForceAtPosition(transformDirection * forcetoAdd, base.transform.position);

if (rudderTransform != null)
{
Expand Down

0 comments on commit be0e2d8

Please sign in to comment.