update
This commit is contained in:
@@ -543,13 +543,14 @@ public class Transmission : PowertrainComponent
|
||||
// Run the first half of shift timer
|
||||
float shiftTimer = 0;
|
||||
float halfDuration = ShiftDuration * 0.5f;
|
||||
if ( !instant )
|
||||
while ( shiftTimer < halfDuration )
|
||||
{
|
||||
ShiftProgress = shiftTimer / ShiftDuration;
|
||||
shiftTimer += dt;
|
||||
await Task.DelayRealtimeSeconds( dt );
|
||||
}
|
||||
|
||||
//if ( !instant )
|
||||
// while ( shiftTimer < halfDuration )
|
||||
// {
|
||||
// ShiftProgress = shiftTimer / ShiftDuration;
|
||||
// shiftTimer += dt;
|
||||
// await Task.DelayRealtimeSeconds( dt );
|
||||
// }
|
||||
|
||||
// Do the shift at the half point of shift duration
|
||||
Gear = targetGear;
|
||||
@@ -603,28 +604,28 @@ public class Transmission : PowertrainComponent
|
||||
float brakeInput = car.SwappedBrakes;
|
||||
int currentGear = Gear;
|
||||
// Assign base shift points
|
||||
_targetDownshiftRPM = _downshiftRPM;
|
||||
_targetUpshiftRPM = _upshiftRPM;
|
||||
|
||||
_targetDownshiftRPM = car.Engine.EstimatedPeakPowerRPM - 2000;
|
||||
_targetUpshiftRPM = car.Engine.EstimatedPeakPowerRPM;
|
||||
|
||||
// Calculate shift points for variable shift RPM
|
||||
if ( VariableShiftPoint )
|
||||
{
|
||||
// Smooth throttle input so that the variable shift point does not shift suddenly and cause gear hunting
|
||||
_smoothedThrottleInput = MathX.Lerp( _smoothedThrottleInput, throttleInput, Time.Delta * 2f );
|
||||
float revLimiterRPM = car.Engine.RevLimiterRPM;
|
||||
//if ( VariableShiftPoint )
|
||||
//{
|
||||
// // Smooth throttle input so that the variable shift point does not shift suddenly and cause gear hunting
|
||||
// _smoothedThrottleInput = MathX.Lerp( _smoothedThrottleInput, throttleInput, Time.Delta * 2f );
|
||||
// float revLimiterRPM = car.Engine.RevLimiterRPM;
|
||||
|
||||
_targetUpshiftRPM = _upshiftRPM + Math.Clamp( _smoothedThrottleInput * VariableShiftIntensity, 0f, 1f ) * _upshiftRPM;
|
||||
_targetUpshiftRPM = Math.Clamp( _targetUpshiftRPM, _upshiftRPM, revLimiterRPM * 0.97f );
|
||||
// _targetUpshiftRPM = _upshiftRPM + Math.Clamp( _smoothedThrottleInput * VariableShiftIntensity, 0f, 1f ) * _upshiftRPM;
|
||||
// _targetUpshiftRPM = Math.Clamp( _targetUpshiftRPM, _upshiftRPM, revLimiterRPM * 0.97f );
|
||||
|
||||
_targetDownshiftRPM = _downshiftRPM + Math.Clamp( _smoothedThrottleInput * VariableShiftIntensity, 0f, 1f ) * _downshiftRPM;
|
||||
_targetDownshiftRPM = Math.Clamp( _targetDownshiftRPM, car.Engine.IdleRPM * 1.1f, _targetUpshiftRPM * 0.7f );
|
||||
// _targetDownshiftRPM = _downshiftRPM + Math.Clamp( _smoothedThrottleInput * VariableShiftIntensity, 0f, 1f ) * _downshiftRPM;
|
||||
// _targetDownshiftRPM = Math.Clamp( _targetDownshiftRPM, car.Engine.IdleRPM * 1.1f, _targetUpshiftRPM * 0.7f );
|
||||
|
||||
// Add incline modifier
|
||||
float inclineModifier = Math.Clamp( car.WorldRotation.Forward.Dot( Vector3.Up ) * InclineEffectCoeff, 0f, 1f );
|
||||
// // Add incline modifier
|
||||
// float inclineModifier = Math.Clamp( car.WorldRotation.Forward.Dot( Vector3.Up ) * InclineEffectCoeff, 0f, 1f );
|
||||
|
||||
_targetUpshiftRPM += revLimiterRPM * inclineModifier;
|
||||
_targetDownshiftRPM += revLimiterRPM * inclineModifier;
|
||||
}
|
||||
// _targetUpshiftRPM += revLimiterRPM * inclineModifier;
|
||||
// _targetDownshiftRPM += revLimiterRPM * inclineModifier;
|
||||
//}
|
||||
|
||||
|
||||
// In neutral
|
||||
|
||||
Reference in New Issue
Block a user