Example #1
0
 public void SuspensionStrengthChanged(object sender, SuspensionStrengthChangedEventArgs e)
 {
     //float newStrength = e.Strength * (float)
     //(Controller.CenterOfMass - Suspension.GetPosition()).Length() / ToGridCenterDistance;
     //if (Math.Round(Suspension.Strength, 1) != Math.Round(newStrength, 1))
     Suspension.Strength = e.Strength;//newStrength;
 }
Example #2
0
            private void UdjustSuspensionStrength()
            {
                float gravityFactor            = (float)_controller.GetNaturalGravity().Length() / 9.81f;
                float truckCurrentMass         = _controller.CalculateShipMass().PhysicalMass *gravityFactor;
                float massToWheelsDifference   = truckCurrentMass / _suspensions.Count;
                float _truckSuspensionStrength = (float)Math.Sqrt(massToWheelsDifference / _suspensionSoftnessFactor);

                SuspensionStrengthChangedEventArgs args = new SuspensionStrengthChangedEventArgs
                {
                    Strength = _truckSuspensionStrength
                };

                ChangeTruckSuspensionStrength?.Invoke(this, args);
            }