Skip to content

Dampening decoupled, then not re-coupled in TWPlus port #65

Description

@mrshine4k

ThePlasticPotato: ade965e - Trackwork Plus Port.

SimpleWheelController.java

     private volatile float suspensionStiffness = 1.0f;
+    private volatile float suspensionDampening = 1.2f;
 
     public SimpleWheelController() {}

    . . . 

             double tilt = 1 + this.tilt(trackRelPosShip);
-            tForce.add(data.suspensionCompression.mul(m * 4.0 * coefficientOfPower * this.suspensionStiffness * tilt, new Vector3d()));
-            tForce.add(trackNormal.mul(m * 1.2 * -suspensionDelta * coefficientOfPower * this.suspensionStiffness, new Vector3d()));
+
+            // Spring force (stiffness) - apply in world coordinates but calculated relative to local up
+            Vector3dc springForce = data.suspensionCompression.mul(m * 4.0 * coefficientOfPower * this.suspensionStiffness * tilt, new Vector3d());
+            tForce.add(springForce);
+
+            // Damper force (dampening) - apply in world coordinates but calculated relative to local up
+            Vector3dc damperForce = trackNormal.mul(m * -suspensionDelta * coefficientOfPower * this.suspensionDampening, new Vector3d());
+            tForce.add(damperForce);
             // Really half-assed antislip when the spring is stronger than friction (what?)
             if (data.wheelRPM == 0) {
                 tForce = new Vector3d(0, tForce.y(), 0);

I noticed suspension force was off the chart at max stiffness on rebound, and remembering twplus port exist so I started digging and yeah. It was decoupled at near vs 2.4 release, no biggie this already fixed in dev. PR soon™️.

Trace of event:

  • TW+ exist, new wheel
  • TW++ decoupled for new dampener tool
  • VS 2.4 port by potato slipped over the decoupled dampening
  • Un-dampened spring go wee

Affected files: SimpleWheelController.java and OleoWheelController.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions