Jacob Mango/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "overriden" to "overridden")
m (Text replacement - "ecieve" to "eceive")
 
Line 160: Line 160:
'''timeToCoupleClutch''' the time for the clutch to be engaged when changing gear.
'''timeToCoupleClutch''' the time for the clutch to be engaged when changing gear.
'''timeToUncoupleClutch''' the time for the clutch to be disengaged when changing gear.
'''timeToUncoupleClutch''' the time for the clutch to be disengaged when changing gear.
'''maxClutchTorque''' the maximum amount of torque that can be transferred from the engine to the gearbox and recieved back into the engine. You will want this higher than the ''torqueMax'' in the Engine class.
'''maxClutchTorque''' the maximum amount of torque that can be transferred from the engine to the gearbox and received back into the engine. You will want this higher than the ''torqueMax'' in the Engine class.


<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">

Latest revision as of 21:38, 27 April 2024

Fluids

fuelCapacity = 50;
fuelConsumption = 11;
brakeFluidCapacity = 1;
oilCapacity = 4;
coolantCapacity = 6;

Lights

The following hidden selections are required in this order. Any additional hidden selections must be appended after the dashboard. You can leave the materials and texture fields as blank strings but the same number of variables must also exist in those.

hiddenSelections[] =
{
	"light_left",
	"light_right",
	"light_brake_1_2",
	"light_brake_2_2",
	"light_reverse_1_2",
	"light_reverse_2_2",
	"light_1_2",
	"light_2_2",
	"light_dashboard"
};

The following config variables can be assigned to rvmats.

dashboardMatOn // 'light_dashboard'
dashboardMatOff // 'light_dashboard'
frontReflectorMatOn // 'light_left'
frontReflectorMatOff // 'light_right'
brakeReflectorMatOn // 'light_brake_1_2'
brakeReflectorMatOff // 'light_brake_2_2'
ReverseReflectorMatOn // 'light_reverse_1_2'
ReverseReflectorMatOff // 'light_reverse_2_2'
TailReflectorMatOn // 'light_1_2'
TailReflectorMatOff // 'light_2_2'

Within the vehicles script class, the lights can be overridden. The light class must extend from 'CarLightBase'.

override CarRearLightBase CreateRearLight()
{
	return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight)); // just a default value
}

override CarLightBase CreateFrontLight()
{
	return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight)); // just a default value
}

Crew

class Crew
{
	class Driver 
	{
		actionSel = "seat_driver";
		proxyPos = "crewDriver";
		getInPos = "pos_driver";
		getInDir = "pos_driver_dir";
		isDriver = true;
	};
	class CoDriver
	{
		actionSel = "seat_coDriver";
		proxyPos = "crewCoDriver";
		getInPos = "pos_coDriver";
		getInDir = "pos_coDriver_dir";
	};
};

Engine

class SimulationModule
{
	drive = "DRIVE_AWD";
	centralDiffRatio = 1.45;
	class Engine
	{
		inertia = 0.15;
		steepness = 1.5;
		torqueMax = 114;
		torqueRpm = 3400;
		powerMax = 53.7;
		powerRpm = 5400;
		rpmIdle = 850;
		rpmMin = 900;
		rpmClutch = 1350;
		rpmRedline = 6000;
		rpmMax = 8000;
	};
};
Default values for the offroad hatchback.

Steering

The three config array variables have the expected format of the first value being the speed in KM/H and the second being the speed the steering wheel will rotate in degrees per second.

increaseSpeed is for when the turn keys (A, D) are pressed. decreaseSpeed is for when the turn keys (A, D) are pressed and the wheel is turned to the opposite direction. centeringSpeed is for when none of the turn key is pressed.

class SimulationModule
{
	class Steering
	{
		increaseSpeed[] = {0,45,60,23,100,12};
		decreaseSpeed[] = {0,80,60,40,90,20};
		centeringSpeed[] = {0,0,15,25,60,40,100,60};
	};
};
Default values for the offroad hatchback.

Throttle

A throttle is represented from 0.0 to 1.0, or 0% to 100%.

reactionTime is the amount of time it takes for the throttle to reach the desired position defaultThrust is the throttle position when just the drive key (W) is pressed. gentleThrust is the throttle position when the slow (LEFT CTRL) and drive key (W) is pressed. There is no configuruation for turbo, it is when the throttle position is at 100%. turboCoef is a modifier on the reactionTime for when the turbo key (LEFT SHIFT) is pressed. gentleCoef is a modifier on the reactionTime for when the slow key (LEFT CTRL) is pressed.

class SimulationModule
{
	class Throttle
	{
		reactionTime = 1.0;
		defaultThrust = 0.85;
		gentleThrust = 0.7;
		turboCoef = 4.0;
		gentleCoef = 0.75;
	};
};
Default values for the offroad hatchback.

Gearbox

reverse the ratio used in reverse. ratios an array of ratios, starting from 1st gear. There are a total of 16 gears possible. timeToCoupleClutch the time for the clutch to be engaged when changing gear. timeToUncoupleClutch the time for the clutch to be disengaged when changing gear. maxClutchTorque the maximum amount of torque that can be transferred from the engine to the gearbox and received back into the engine. You will want this higher than the torqueMax in the Engine class.

class SimulationModule
{
	class Gearbox
	{
		reverse = 3.526;
		ratios[] = {3.667,2.1,1.361,1.0};
		timeToUncoupleClutch = 0.3;
		timeToCoupleClutch = 0.45;
		maxClutchTorque = 260;
	};
};
Default values for the offroad hatchback.

Braking

This is the nominal amount of braking that should be applied based on how long the brake key has been pressed. The first value is time in seconds, the second is the normalized brake amount. In the following configuration at 0 seconds 10% of braking is applied and at 3 seconds 100% of braking is applied.

class SimulationModule
{
	braking[] = {0.0,0.1,1.0,0.8,2.5,0.9,3.0,1.0};
};
Default values for the offroad hatchback.

Axles

maxSteeringAngle is the max angle the wheel can turn at. Can be negative for rear wheel steering. finalRatio is how much more faster the axle (and wheel) will rotate at compared to the parent differential. brakeBias is how much of the total brake will be used on the axle. The total between all axles must equal 1. brakeForce is the maximum amount of force the brakes will use to stop the axle from spinning. wheelHubRadius is the radius of the wheel hub within the model. wheelHubMass is the mass of the wheel hub within the model. wheelHubRatio needs testing.

The parent differntial would usually be the gearbox, except when the 662, 642 or AWD drive trains are used, then centralDiffRatio will be used instead.

class SimulationModule
{
	class Axles
	{
		class Front
		{
			maxSteeringAngle = 30;
			finalRatio = 4.1;
			brakeBias = 0.6;
			brakeForce = 4000;
			wheelHubMass = 5;
			wheelHubRadius = 0.15;
		};
		class Rear
		{
			maxSteeringAngle = 0;
			finalRatio = 4.1;
			brakeBias = 0.4;
			brakeForce = 3800;
			wheelHubMass = 5;
			wheelHubRadius = 0.15;
		};
		class Middle : Rear
		{
		};
	};
};
Default values for the offroad hatchback.
Middle can only be used in 6 wheel engine type.

Suspension

stiffness is a value expressed in newtons per metre. The more the suspension is compressed the more stiffness is applied as it is multiplied by the distance the wheel has moved from the wheels lowest point along it's axle.

The following equation can be used to find the value

stiffness = ((mass / numberOfWheels) * gravityConstant) / maxTravelDown

where:

  • mass is taken from the geometry LOD of the model
  • gravityConstant is the default gravity used in DayZ, 9.81m/s
  • numberOfWheels is the total number of wheels on the vehicle
  • maxTravelDown is from the suspension configuration

compression and damping are forces that counter-act the suspension movement so it reaches equilibrium faster. A good starting point for compression is stiffness / 10 and for damping is compression * 3.

You will need to adjust these values to a higher value as this is only for when the vehicle is at a standstill.

class SimulationModule
{
	class Axles
	{
		class Front
		{
			class Suspension
			{
				swayBar = 1700;
				stiffness = 40000;
				compression = 2100;
				damping = 7500;
				travelMaxUp = 0.0882;
				travelMaxDown = 0.0833;
			};
		};
	};
};
Default values for the offroad hatchback.

Computing Theoretical Maximum Speed

To compute the theoretical maximum speed in metres per second you will need to use the following equation. This is just a theoretical maximum speed and factors such as rolling resistance, air resistance, road surface, tire wear and others aren't taken into account.

engineRadsPerSecond = engineRotationsPerMinute * (PI / 30)

Using any gear ratio from the gearbox ratios or reverse variable

gearRadsPerSecond = engineRadsPerSecond / gearRatio

If the engine type is one of the following 662, 642 or AWD, then

axleRadsPerSecond = gearRadsPerSecond / centralDiffRatio / finalRatio

Otherwise,

axleRadsPerSecond = gearRadsPerSecond / finalRatio

And then convert to a potential speed

speedMetresPerSecond = axleRadsPerSecond * wheelRadius
speedKilometresPerHour = speedMetresPerSecond * 3.6
speedMilesPerHour = speedMetresPerSecond * 0.44704