Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making Firespitter compatible with Principia V2.0 #213

Open
wants to merge 2 commits into
base: DEVELOP
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
this.part.AddForceAtPosition(liftVector, liftTransform.position);

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

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

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

// Warning: what happens when commonRigidBody is null? See getLiftAndDrag on line 75!
this.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);
this.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 @@ -110,7 +110,7 @@ public override void OnFixedUpdate()
if (!resourceReceived)
thrustUsed = 0f;
if (thrustUsed > 0f)
part.gameObject.GetComponent<Rigidbody>().AddForceAtPosition(finalThrust, t.transform.position);
this.part.AddForceAtPosition(finalThrust, t.transform.position);
if (useFX)
{
particleFX[i].pEmitter.minEmission = defaultEmitterMinEmission * thrustUsed;
Expand Down Expand Up @@ -149,7 +149,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);
this.part.AddForceAtPosition(-thrustDirection * thrustModifier * maxThrust, t.transform.position);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Firespitter/water/FSbuoyancy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void FixedUpdate()

if (vessel.verticalSpeed < maxVerticalSpeed) // || relativeDirection < 0f) // if you are going down, apply force regardless, of going up, limit up speed
{
this.part.GetComponent<Rigidbody>().AddForceAtPosition(uplift, forcePoint.position);
this.part.AddForceAtPosition(uplift, forcePoint.position);
}
}

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);
this.part.AddForceAtPosition(transformDirection * forcetoAdd, base.transform.position);

if (rudderTransform != null)
{
Expand Down