Changing Vehicle Performance

Changing Vehicle Performance

by Keester
updated by tanfhltu

Open up a vehicle’s Physics.con and the Engine is usually the first thing defined

All of these settings should be settable by either directly editing the Objects.rfa, or by doing an ObjectTemplate.Active Vehicle_Engine, where Vehicle_Engine is the name of the vehicle’s engine you want to tweak, and then putting the lines shown below with your new setting (if you used this second method, then you can put the code at the end of your ObjectSpawnTemplates.con in the map you were modding)

Vehicle Speed Properties
Acceleration Properties
Land Vehicle Gear Properties
Handling Properties
Steering Properties


Vehicle Speed properties:

ObjectTemplate.setTorque number
ObjectTemplate.setDifferential number

ObjectTemplate.setTorque – Simply put, the higher setTorque is on a vehicle, the better it can maintain a speed while going up an incline. The M1A1 and Bradley have a setTorque of 10, while the M109 has a setTorque of 5. Therefore, the M1A1 and Bradley will go faster than the M109 when going up hill.

On a level roadway, setTorque has no bearing on speed.

ObjectTemplate.setDifferential – This number will set the maximum speed of a vehicle when traveling on a level path. However it will not affect the speed if the vehicle begins traveling up an incline.

I didn’t code the BF engine, but if I had to make an educated guess, I would say the formula for the maximum speed of a vehicle would be similar to:

     (1 + setTorque * sin(a))*(1 + setDifferential * cos(a))

Where ‘a’ is the angle of the incline. Of course, I doubt this is exact, but it should give you the idea of how these two settings effect the maximum speed of a vehicle.

It may be possible to get an exact formula by setting the setTorque and setDifferential to 1, and then timing how long it takes a vehicle to go from one coordinate to another (at top speed) up various inclines…


Acceleration Properties:

ObjectTemplate.setAcceleration x/y/z
ObjectTemplate.setMinRotation x/y/z
ObjectTemplate.setMaxRotation x/y/z

All of these settings have an effect on a vehicle’s accelleration.

ObjectTemplate.setAcceleration – Just provide a Z, at least for land vehicles. taken from pbf: „sets how quickly the engine accelerates when changing between speed settings, e.g., low acceleration will make turning sluggish but will increase in response the longer you hold the throttle key. Having it set very high should make the car start to alter speed settings more rapidly (which results in faster response). This controls how quickly the SetMaxSpeed part can get up to its set speeds, which in turn sets how quickly the engine changes between the individual speed segments”

ObjectTemplate.setMinRotation and ObjectTemplate.setMaxRotationtaken from pbf: „SetMinRotation and SetMaxRotation for the Engine set how fine the control scale is for the engine (basically how many distinct speeds the engine can be at). For example, a SetMinRotation of -100 and SetMaxRotation of 200 means that the total speed is split into 100 different speeds for reversing and and 200 different speeds for going forward (so feasibly you could control the engine in such a way as to be able to go at 200 different speeds but none between them).”

ObjectTemplate.setMaxSpeed – This is not the maximum speed of the vehicle, but the maximum speed of the engine (think of it as the maximum speed of the turn shaft in an engine).


Land Vehicle Gear Properties:

ObjectTemplate.setNumberOfGears number

number can be 1-5. In land vehicles, the engine provides it’s power through spring objects. setNumberOfGears controls the amount of power applied to the springs

ObjectTemplate.setGearUp number

The percentage of total power at which the engine will upshift

ObjectTemplate.setGearDown number

The percentage of total power at which the engine will downshift. You’ll probably break something if this is higher than setGearUp

ObjectTemplate.setGearChangeTime number

How long it takes to change gears. .01 on most DC land vehicles


Handling Properties:

ObjectTemplate.setPivotPosition x/y/z

The offset of the center of rotation from the center of the vehicle

ObjectTemplate.Drag CRD

ObjectTemplate.InertiaModifier x/y/z

ObjectTemplate.Mass number

The above settings you’ll find in the vehicles OBjects.con file. I don’t think you can change the mass number without causing a crash, but I can’t remember…


Steering Properties

To change the sharp the vehicle turns, find the wheels for the vehicle in the vehicles objects.con file. It’ll usually end with …FrontWheelR, …FrontWheelL. For example, to increase how sharp the Humvee can turn, the following code in your ObjectSpawnTemplates.con file will work:

ObjectTemplate.Active HumveeFrontWheelR
ObjectTemplate.setMinRotation -100/0/0
ObjectTemplate.setMaxRotation 100/0/0

ObjectTemplate.Active HumveeFrontWheelL
ObjectTemplate.setMinRotation -100/0/0
ObjectTemplate.setMaxRotation 100/0/0

The -100 and 100 are normally -60 and 60 respectively.

Vélemény, hozzászólás?