peak long drag
This commit is contained in:
parent
562750107a
commit
b978b821fa
@ -173,7 +173,7 @@ public partial class Clutch : PowertrainComponent
|
|||||||
OutputInertia = (inertiaSum + halfClutchInertia) * _clutchEngagement + halfClutchInertia;
|
OutputInertia = (inertiaSum + halfClutchInertia) * _clutchEngagement + halfClutchInertia;
|
||||||
|
|
||||||
// Allow the torque output to be only up to the slip torque valu
|
// Allow the torque output to be only up to the slip torque valu
|
||||||
float outputTorqueClamp = SlipTorque * _clutchEngagement;
|
float outputTorqueClamp = Controller.Engine.EstimatedPeakTorque * 1.5f * _clutchEngagement;
|
||||||
|
|
||||||
OutputTorque = InputTorque;
|
OutputTorque = InputTorque;
|
||||||
OutputTorque = Math.Clamp( OutputTorque, 0, outputTorqueClamp );
|
OutputTorque = Math.Clamp( OutputTorque, 0, outputTorqueClamp );
|
||||||
|
|||||||
@ -250,11 +250,13 @@ public partial class VeloXWheel
|
|||||||
lowSpeedReferenceIsSet = false;
|
lowSpeedReferenceIsSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ForwardFriction.Force = Math.Clamp( ForwardFriction.Force, -peakForwardFrictionForce, peakForwardFrictionForce );
|
ForwardFriction.Force = Math.Clamp( ForwardFriction.Force, -peakForwardFrictionForce, peakForwardFrictionForce );
|
||||||
|
|
||||||
SidewayFriction.Force = Math.Clamp( SidewayFriction.Force, -peakSideFrictionForce, peakSideFrictionForce );
|
SidewayFriction.Force = Math.Clamp( SidewayFriction.Force, -peakSideFrictionForce, peakSideFrictionForce );
|
||||||
|
|
||||||
if ( absForwardSpeed > 2f || absAngularVelocity > 4f )
|
|
||||||
|
if ( absForwardSpeed > 0.01f || absAngularVelocity > 0.01f )
|
||||||
{
|
{
|
||||||
|
|
||||||
float forwardSlipPercent = ForwardFriction.Slip / Tire.GetPeakSlip();
|
float forwardSlipPercent = ForwardFriction.Slip / Tire.GetPeakSlip();
|
||||||
@ -262,7 +264,7 @@ public partial class VeloXWheel
|
|||||||
float slipCircleLimit = MathF.Sqrt( forwardSlipPercent * forwardSlipPercent + sideSlipPercent * sideSlipPercent );
|
float slipCircleLimit = MathF.Sqrt( forwardSlipPercent * forwardSlipPercent + sideSlipPercent * sideSlipPercent );
|
||||||
if ( slipCircleLimit > 1f )
|
if ( slipCircleLimit > 1f )
|
||||||
{
|
{
|
||||||
float beta = MathF.Atan2( sideSlipPercent, forwardSlipPercent * 0.9f );
|
float beta = MathF.Atan2( sideSlipPercent, forwardSlipPercent * 1.05f );
|
||||||
float sinBeta = MathF.Sin( beta );
|
float sinBeta = MathF.Sin( beta );
|
||||||
float cosBeta = MathF.Cos( beta );
|
float cosBeta = MathF.Cos( beta );
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public partial class VeloXCar
|
|||||||
_sideArea = Dimensions.y * Dimensions.z * 0.8f;
|
_sideArea = Dimensions.y * Dimensions.z * 0.8f;
|
||||||
_forwardSpeed = LocalVelocity.x.InchToMeter();
|
_forwardSpeed = LocalVelocity.x.InchToMeter();
|
||||||
_sideSpeed = LocalVelocity.y.InchToMeter();
|
_sideSpeed = LocalVelocity.y.InchToMeter();
|
||||||
longitudinalDragForce = 0.5f * RHO * _frontalArea * FrontalCd * (_forwardSpeed * _forwardSpeed) * (_forwardSpeed > 0 ? -1f : 1f);
|
longitudinalDragForce = 2 * RHO * _frontalArea * FrontalCd * (_forwardSpeed * _forwardSpeed) * (_forwardSpeed > 0 ? -1f : 1f);
|
||||||
lateralDragForce = 0.5f * RHO * _sideArea * SideCd * (_sideSpeed * _sideSpeed) * (_sideSpeed > 0 ? -1f : 1f);
|
lateralDragForce = 0.5f * RHO * _sideArea * SideCd * (_sideSpeed * _sideSpeed) * (_sideSpeed > 0 ? -1f : 1f);
|
||||||
var force = new Vector3( longitudinalDragForce.MeterToInch(), lateralDragForce.MeterToInch(), 0 ).RotateAround( Vector3.Zero, WorldRotation );
|
var force = new Vector3( longitudinalDragForce.MeterToInch(), lateralDragForce.MeterToInch(), 0 ).RotateAround( Vector3.Zero, WorldRotation );
|
||||||
Body.ApplyForce( force );
|
Body.ApplyForce( force );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user