From dd00c83f7419df7251739c6cc7108264561873b9 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 29 Mar 2021 16:48:59 +0200 Subject: [PATCH] Add clutch strength option --- .../Engine/Physics/Actors/WheeledVehicle.cpp | 6 +-- Source/Engine/Physics/Actors/WheeledVehicle.h | 45 +++++++++++-------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.cpp b/Source/Engine/Physics/Actors/WheeledVehicle.cpp index 84b0c5144..8a206be74 100644 --- a/Source/Engine/Physics/Actors/WheeledVehicle.cpp +++ b/Source/Engine/Physics/Actors/WheeledVehicle.cpp @@ -433,8 +433,7 @@ void WheeledVehicle::Setup() // Clutch PxVehicleClutchData clutch; - // TODO: expose Clutch options - clutch.mStrength = M2ToCm2(10.0f); + clutch.mStrength = M2ToCm2(_gearbox.ClutchStrength); driveSimData.setClutchData(clutch); // Ackermann steer accuracy @@ -484,8 +483,7 @@ void WheeledVehicle::Setup() // Clutch PxVehicleClutchData clutch; - // TODO: expose Clutch options - clutch.mStrength = M2ToCm2(10.0f); + clutch.mStrength = M2ToCm2(_gearbox.ClutchStrength); driveSimData.setClutchData(clutch); // Create vehicle drive diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.h b/Source/Engine/Physics/Actors/WheeledVehicle.h index 62db24231..567539c04 100644 --- a/Source/Engine/Physics/Actors/WheeledVehicle.h +++ b/Source/Engine/Physics/Actors/WheeledVehicle.h @@ -31,25 +31,6 @@ public: NoDrive, }; - /// - /// Vehicle gearbox settings. - /// - API_STRUCT() struct GearboxSettings : ISerializable - { - DECLARE_SCRIPTING_TYPE_MINIMAL(GearboxSettings); - API_AUTO_SERIALIZATION(); - - /// - /// If enabled the vehicle gears will be changes automatically, otherwise it's fully manual. - /// - API_FIELD() bool AutoGear = true; - - /// - /// Time it takes to switch gear. Specified in seconds (s). - /// - API_FIELD() float SwitchTime = 0.5f; - }; - /// /// Vehicle engine settings. /// @@ -137,6 +118,32 @@ public: API_FIELD(Attributes="LimitAttribute(1)") float RearBias = 1.3f; }; + /// + /// Vehicle gearbox settings. + /// + API_STRUCT() struct GearboxSettings : ISerializable + { + DECLARE_SCRIPTING_TYPE_MINIMAL(GearboxSettings); + API_AUTO_SERIALIZATION(); + + /// + /// If enabled the vehicle gears will be changes automatically, otherwise it's fully manual. + /// + API_FIELD() bool AutoGear = true; + + /// + /// Time it takes to switch gear. Specified in seconds (s). + /// + API_FIELD(Attributes="LimitAttribute(0)") float SwitchTime = 0.5f; + + /// + /// Strength of clutch. A stronger clutch more strongly couples the engine to the wheels, while a clutch of strength zero completely decouples the engine from the wheels. + /// Stronger clutches more quickly bring the wheels and engine into equilibrium, while weaker clutches take longer, resulting in periods of clutch slip and delays in power transmission from the engine to the wheels. + /// Specified in kilograms metres-squared per second (kg m^2 s^-1). + /// + API_FIELD(Attributes="LimitAttribute(0)") float ClutchStrength = 10.0f; + }; + /// /// Vehicle wheel types. ///