new maps and other improvements
This commit is contained in:
@@ -40,7 +40,7 @@ public partial class VeloXCar
|
||||
_sideArea = Dimensions.y * Dimensions.z * 0.8f;
|
||||
_forwardSpeed = LocalVelocity.x.InchToMeter();
|
||||
_sideSpeed = LocalVelocity.y.InchToMeter();
|
||||
longitudinalDragForce = 2 * RHO * _frontalArea * FrontalCd * (_forwardSpeed * _forwardSpeed) * (_forwardSpeed > 0 ? -1f : 1f);
|
||||
longitudinalDragForce = 0.5f * RHO * _frontalArea * FrontalCd * (_forwardSpeed * _forwardSpeed) * (_forwardSpeed > 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 );
|
||||
Body.ApplyForce( force );
|
||||
|
||||
@@ -38,11 +38,21 @@ public partial class VeloXCar : VeloXBase
|
||||
if ( Math.Abs( inputSteer ) < 0.1f )
|
||||
return;
|
||||
|
||||
if ( Math.Abs( WorldRotation.Angles().roll ) < 70 )
|
||||
if ( IsOnGround && Math.Abs( WorldRotation.Roll() ) < 60 )
|
||||
return;
|
||||
|
||||
var angVel = Body.AngularVelocity;
|
||||
var force = inputSteer * Mass * Math.Clamp( 1 - angVel.x / 50, 0, 1 ) * 0.05f;
|
||||
var angVel = Body.WorldTransform.PointToLocal( WorldPosition + Body.AngularVelocity );
|
||||
|
||||
|
||||
float maxAngularVelocity = 2.0f;
|
||||
|
||||
float velocityFactor = 1.0f - Math.Clamp( Math.Abs( angVel.x ) / maxAngularVelocity, 0f, 1f );
|
||||
|
||||
if ( velocityFactor <= 0.01f )
|
||||
return;
|
||||
|
||||
var force = inputSteer * velocityFactor * 150;
|
||||
|
||||
Body.AngularVelocity -= Body.WorldRotation.Forward * force * dt;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user