Add clutch strength option

This commit is contained in:
Wojtek Figat
2021-03-29 16:48:59 +02:00
parent 6ad8e8b133
commit dd00c83f74
2 changed files with 28 additions and 23 deletions

View File

@@ -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

View File

@@ -31,25 +31,6 @@ public:
NoDrive,
};
/// <summary>
/// Vehicle gearbox settings.
/// </summary>
API_STRUCT() struct GearboxSettings : ISerializable
{
DECLARE_SCRIPTING_TYPE_MINIMAL(GearboxSettings);
API_AUTO_SERIALIZATION();
/// <summary>
/// If enabled the vehicle gears will be changes automatically, otherwise it's fully manual.
/// </summary>
API_FIELD() bool AutoGear = true;
/// <summary>
/// Time it takes to switch gear. Specified in seconds (s).
/// </summary>
API_FIELD() float SwitchTime = 0.5f;
};
/// <summary>
/// Vehicle engine settings.
/// </summary>
@@ -137,6 +118,32 @@ public:
API_FIELD(Attributes="LimitAttribute(1)") float RearBias = 1.3f;
};
/// <summary>
/// Vehicle gearbox settings.
/// </summary>
API_STRUCT() struct GearboxSettings : ISerializable
{
DECLARE_SCRIPTING_TYPE_MINIMAL(GearboxSettings);
API_AUTO_SERIALIZATION();
/// <summary>
/// If enabled the vehicle gears will be changes automatically, otherwise it's fully manual.
/// </summary>
API_FIELD() bool AutoGear = true;
/// <summary>
/// Time it takes to switch gear. Specified in seconds (s).
/// </summary>
API_FIELD(Attributes="LimitAttribute(0)") float SwitchTime = 0.5f;
/// <summary>
/// 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).
/// </summary>
API_FIELD(Attributes="LimitAttribute(0)") float ClutchStrength = 10.0f;
};
/// <summary>
/// Vehicle wheel types.
/// </summary>