You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[MotorSim] adding back decel scale, which was missed from the rev limiter component. re-implementing directly on the physics sim component for control.
#rnx #rb trivial [CL 27433642 by miles flanagan in ue5-main branch]
This commit is contained in:
@@ -22,13 +22,14 @@ void UMotorPhysicsSimComponent::Update(FAudioMotorSimInputContext& Input, FAudio
|
||||
const int32 PrevGear = Gear;
|
||||
|
||||
const float ClutchModifier = Input.bClutchEngaged ? ClutchedForceModifier : 1.f;
|
||||
|
||||
const float ClutchDecelModifier = Input.bClutchEngaged ? FMath::Max(ClutchedDecelScale * (1.f - Throttle), 0.f) : 1.f;
|
||||
|
||||
//Forces in Newtons.
|
||||
const float CurrentEngineTorque = EngineTorque * Throttle * GearRatio * ClutchModifier;
|
||||
|
||||
const float BrakingForce = Input.Brake * BrakingHorsePower;
|
||||
const float WindResistance = WindResistancePerVelocity * FMath::Square(SpeedKmh);
|
||||
const float FrictionResistance = Weight * GroundFriction * Input.SurfaceFrictionModifier;
|
||||
const float FrictionResistance = Weight * GroundFriction * Input.SurfaceFrictionModifier * ClutchDecelModifier;
|
||||
const float EngineResistance = CurrentEngineTorque * FMath::Max(Input.MotorFrictionModifier - Throttle, 0.0f) * EngineFriction;
|
||||
|
||||
const float NetForce = CurrentEngineTorque - BrakingForce - WindResistance - FrictionResistance - EngineResistance;
|
||||
|
||||
@@ -46,6 +46,10 @@ public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Resistance")
|
||||
float ClutchedForceModifier = 1.f;
|
||||
|
||||
// how much more quickly the engine decelerates off-throttle while clutched
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Resistance")
|
||||
float ClutchedDecelScale = 1.f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Resistance")
|
||||
float EngineGearRatio = 50.f;
|
||||
|
||||
Reference in New Issue
Block a user