CityDriver

CityDriver

Not enough ratings
Vehicle Modding
By ScoDev and 2 collaborators
Welcome to the official modding documentation by ViewApp for CityDriver! In this documentation, we will show you how to create your own modding project for CityDriver and add it to the game.
   
Award
Favorite
Favorited
Unfavorite
Introduction
Welcome to the official modding documentation by ViewApp for CityDriver! In this documentation, we will show you how to create your own modding project for CityDriver and add it to the game.

However, before we can get started, we must ensure we have the necessary tools. One of the most essential tools for modding CityDriver is the Unreal Engine. This software is required to load your own assets such as meshes, sounds and textures into the game in the correct file format unique to Unreal Engine.

Please make sure that you are using Unreal Engine 5.1 to mod the current version of CityDriver. You can download the engine here: https://www.unrealengine.com/en/download

Lua scripts are used to program logic. Please note that we cannot provide explanations on programming with Lua or creating 3D models in this documentation, and therefore require this knowledge to create a mod for CityDriver.

In case you want gather and exchange knowledge with the developers and the rest of the community, feel free to join us on our Discord: https://discord.gg/viewapp-community
Create a new vehicle
Copy an existing vehicle
The easiest way to create a new vehicle is first to copy an existing vehicle. Open the CityDriver installation directory. In the folder "CityDriver/Content/Paks/Vehicles" you will find both the player and AI vehicles. You shouldn't modify files in this folder though as your changes may get overwritten by updates of the game. All mods that you create can be placed in DOCUMENTS/ViewApp/CityDriver/Vehicles/ so for example DOCUMENTS/ViewApp/CityDriver/Vehicles/NewVehicleABC/

Select an existing player vehicle and make a copy of the corresponding folder and move it to the folder mentioned above. Give the copied folder a meaningful name (preferably the name of your vehicle) and open it. Open the file "data.json" with a text editor (e.g. Windows Editor, Notepad++, ...).

The first and most crucial step in the "data.json" is to assign a unique ID to the vehicle. To get an ID, open the following page: https://guidgenerator.com/online-guid-generator.aspx Uncheck "Hyphens" and click "Generate some GUIDs!". As a result, you will get a letter combination that you can use as an ID. Copy this letter combination to the clipboard. In the "data.json" search for the entries "id" and "selectedProfileId" and replace the existing letter combination for both with the new ID from the clipboard.

Enter the metadata
Within the entry "meta" you can enter various metadata:
Parameter
Datay type
Description
manufacturer
String
The manufacturer's name, e.g. Volta
playerDriveable
Boolean
"true" indicates that the vehicle is a player vehicle, and "false" indicates that it is an AI vehicle.
model
String
The vehicle model name, e.g. Model E
author
String
Author of this vehicle mod (that will probably be your name or nickname)
version
String
Version number of the mod, e.g. 0.1 or 1.0
description
String
A short description of the vehicle
category
String
Type of vehicle. Currently available: Sedan, Coupe, SportsCar, StationWagon, Hatchback, Convertible, SUV, MiniVan, Van, PickUp, Transport, Other

Example
"meta": { "manufacturer": "Volta", "playerDriveable": true, "model": "Model E", "author": "ViewApp GmbH", "version": "0.1", "description": "The Volta Model E features a high-performance electric powertrain, rapid acceleration, long range and fast charging capability.", "category": "Sedan" },
Using own assets with Unreal Engine
To use your own assets in the game you have to import them into an Unreal Engine project and then export a package of your assets to have them loaded into the game. We created a project for you which includes a plugin with some tools to make things easier. You can download it from here: https://dl.viewapp.com/CityDriverModdingProject.zip

You can get going by opening the project using Unreal Engine 5.1 and importing your first assets. Make sure to only import assets into the plugin folder "MyCar1 Content" :

Make sure that any assets you use are located in this folder or else they won't be exported and won't load into the game.

When you are happy with the assets you imported click on the export button which you can find in the toolbar:


The export process requires a folder to be chosen. All modded vehicles should be placed into the DOCUMENTS/ViewApp/CityDriver/Vehicles folder. So you can go ahead and create a folder called "MyCar1" and select it in the dialogue. The assets will then be exported to the target folder and will be ready to load into the game at the next startup.
Set up vehicle meshes - pt.1
Skeleton
For animations, a skeleton must be present. The Skeletal Mesh should not contain any meshes, but only the corresponding bones. The following bones must be present and named exactly as such:

Name of the bone/joint
Description
jnt_Car_root
The root bone. The chassis will be attached to this bone.
jnt_Wheel_front_L
The wheel suspension of the left front wheel incl. brake
jnt_Wheel_front_R
The wheel suspension of the right front wheel incl. brake
jnt_Wheel_rear_L
The wheel suspension of the left rear wheel incl. brake
jnt_Wheel_rear_R
The wheel suspension of the right rear wheel incl. brake
jnt_Tire_front_L
The left front tyre. Should be a child of jnt_Wheel_front_L
jnt_Tire_front_R
The right front tyre. Should be a child of jnt_Wheel_front_R
jnt_Tire_rear_L
The left rear tyre. Should be a child of jnt_Wheel_rear_L
jnt_Tire_rear_R
The right rear tyre. Should be a child of jnt_Wheel_rear_R

Furthermore, for each part of the vehicle that is to be animated (e.g. doors, steering wheel, buttons, ...) there must be a separate bone at the corresponding position. These bones can be named as desired.

Export the bones from your 3D software as an FBX file and import them into the Unreal Editor. Open the Skeletal Mesh. Under Asset Details->Physics->Physics Asset click on Create New Asset->Physics Asset. Choose a file name and location and click Save. In the next step, select the imported SkeletalMesh. In the next step enter 0.0 for "Min Bone Size" and click on "Create Asset". If you have done everything correctly, you should receive a corresponding PhysicsAsset. Make sure that this PhysicsAsset is linked in the SkeletalMesh as a PhysicsAsset.

To link the SkeletalMesh to the vehicle, first right-click on the SkeletalMesh in the Unreal Editor and select "Copy Reference". In the file "data.json" find the entry "skeletonReferencePath" and paste the copied reference there.

Static Meshes
The chassis, the wheels and all parts of the vehicle that are to be animated independently of each other (e.g. doors, steering wheel, buttons, ...) must be available as separate meshes. Export these parts individually as FBX files and import them in the Unreal Editor.

Chassis
Static meshes should be linked in the vehicle folder in the file "profiles/default.json". First, the chassis should be linked. Search for the entry "chassis". There are the following entries:

Parameter
Data type
Description
meshReferencePath
Reference Path
Reference to the StaticMesh. (Right-click on the StaticMesh and select "Copy Reference" to get it)
width
Float
Vehicle width in centimetres
height
Float
Vehicle height in centimetres
mass
Float
Vehicle weight in kilogram
dragCoefficient
Float
downforceCoefficient
Float
Downforce Coefficient... If the vehicle shakes at high speeds, this value should be adjusted (usually it should be increased).
CenterOfMassOffset
Vector
This can be used to shift the centre of gravity. These values have a great influence on the driving behaviour. The X-value can be used to influence whether the vehicle tends to oversteer or understeer: a positive value causes understeer, and a negative value causes oversteer. The Y-value should always be 0. The Z-value should always be negative. A more negative value results in a tighter chassis, while an only slightly negative value results in a soft chassis.
Set up vehicle meshes - pt.2
Wheels
Next, the wheels can be entered. Each wheel has its own entry, which can have the following parameters:

Parameter
Data type
Optional
Description
meshReferencePath
Reference Path
Reference to the StaticMesh. (Right click on the StaticMesh and select "Copy Reference")
verticalPosition
String
"front" or "rear", according to the position of the wheel
horizontalPosition
String
X
"left" or "right", corresponding to the position of the wheel.
affectedBySteering
Boolean
Determines whether this wheel can be steered.
affectedByEngine
Boolean
Determines whether the engine drives this wheel
affectedByBrakes
Boolean
Determines whether this wheel is braked
affectedByHandbrake
Boolean
Determines whether the handbrake affects this wheel.
rimRadius
Float
The radius of the rim in centimetres
radius
Float
The radius of the tyre in centimetres
width
Float
The width of the tyre in centimetres
frictionForceMultiplier
Float
X
Factor for how good the grip of this wheel is
springRate
Float
X
Spring rate
springPreload
Float
X
Spring preload
maxBrakeTorque
Float
X
Maximum braking force on this wheel in Newton metres
maxHandBrakeTorque
Float
X
Maximum hand brake force at this wheel in Newton metres
maxBrakeSpeed
Float
X
corneringStiffness
Float
X
sideSlipModifier
Float
X
slipThreshold
Float
X
skidThreshold
Float
X
suspensionAxis
Vector
X
suspensionForceOffset
Vector
X
suspensionMaxRaise
Float
X
suspensionMaxDrop
Float
X
suspensionDampingRatio
Float
X
suspensionSmoothing
Float
X
wheelLoadRatio
Float
X
rollbarScaling
Float
X
maxSteerAngle
Float
X

Example
"wheels": [ { "meshReferencePath": "StaticMesh'/Game/Vehicles/Cars/VW_Golf7_TSi_2019/Meshes/SM_MA_Pelota7TSi_Tire_front_L.SM_MA_Pelota7TSi_Tire_front_L'", "verticalPosition": "front", "horizontalPosition": "left", "affectedBySteering": true, "affectedByEngine": true, "affectedByBrakes": true, "affectedByHandbrake": false, "radius": 32, "width": 23, "frictionForceMultiplier": 6.0, "springRate": 80.0, "springPreload": 50.0, "maxBrakeTorque": 1700.0, "suspensionDampingRatio": 0.1, "corneringStiffness": 500.0 }, { "meshReferencePath": "StaticMesh'/Game/Vehicles/Cars/VW_Golf7_TSi_2019/Meshes/SM_MA_Pelota7TSi_Tire_front_L.SM_MA_Pelota7TSi_Tire_front_L'", "verticalPosition": "front", "horizontalPosition": "right", "affectedBySteering": true, "affectedByEngine": true, "affectedByBrakes": true, "affectedByHandbrake": false, "radius": 32, "width": 23, "frictionForceMultiplier": 6.0, "springRate": 80.0, "springPreload": 50.0, "maxBrakeTorque": 1700.0, "suspensionDampingRatio": 0.1, "corneringStiffness": 500.0 }, { "meshReferencePath": "StaticMesh'/Game/Vehicles/Cars/VW_Golf7_TSi_2019/Meshes/SM_MA_Pelota7TSi_Tire_front_L.SM_MA_Pelota7TSi_Tire_front_L'", "verticalPosition": "rear", "horizontalPosition": "left", "affectedByEngine": false, "affectedByBrakes": true, "affectedByHandbrake": true, "radius": 32, "width": 23, "frictionForceMultiplier": 6.0, "springRate": 80.0, "springPreload": 50.0, "maxBrakeTorque": 1700.0, "maxHandBrakeTorque": 1700.0, "suspensionDampingRatio": 0.1, "corneringStiffness": 500.0 }, { "meshReferencePath": "StaticMesh'/Game/Vehicles/Cars/VW_Golf7_TSi_2019/Meshes/SM_MA_Pelota7TSi_Tire_front_L.SM_MA_Pelota7TSi_Tire_front_L'", "verticalPosition": "rear", "horizontalPosition": "right", "affectedByEngine": false, "affectedByBrakes": true, "affectedByHandbrake": true, "radius": 32, "width": 23, "frictionForceMultiplier": 6.0, "springRate": 80.0, "springPreload": 50.0, "maxBrakeTorque": 1700.0, "maxHandBrakeTorque": 1700.0, "suspensionDampingRatio": 0.1, "corneringStiffness": 500.0 } ]
Set up vehicle meshes - pt.3
Attachments
All other meshes must be linked as attachments. The following parameters are relevant for an attachment:

Parameter
Data type
Optional
Description
name
String
The name of the attachment, can be chosen arbitrarily.
role
String
X
The role of the attachment. See below for more details.
meshReferencePath
Reference path
Reference to the StaticMesh. (Right-click on the StaticMesh and select "Copy Reference")
target
String
Name of the bone to which the attachment should be attached.
positionOffset
Vector
X
This can be used to move the position of the attachment relative to the bone.
rotationOffset
Vector
X
This can be used to change the rotation of the attachment relative to the bone.

There are additional attachment parameters, which will be explained in the appropriate section.

Role
Certain attachments must be assigned a role in order to function correctly. Currently, there are the following roles:

Role name
Description
SteeringWheel
Steering wheel
FrontLeftDoor
Left front door
FrontRightDoor
Right front door
RearLeftDoor
Left rear door
RearRightDoor
Right rear door
EngineHood
Bonnet or Frunk
Trunk
Trunk/Boot lid
Driver
Driver asset
Passenger
Passenger asset

Example
{ "name": "SteeringWheel", "meshReferencePath": "StaticMesh'/Game/Vehicles/Cars/VW_Golf7_TSi_2019/Meshes/SM_MA_Pelota7TSi_SteeringWheel.SM_MA_Pelota7TSi_SteeringWheel'", "target": "jnt_SteeringWheel", "role": "SteeringWheel" }, { "name": "Driver", "role": "Driver", "meshReferencePath": "StaticMesh'/Game/Crowd/Character/DrivingPoseMeshes/Tesla_Model3/Clemens/Clemens_DP_Tesla_Model3.Clemens_DP_Tesla_Model3'", "target": "jnt_Car_root", "positionOffset": { "x": 0, "y": 0, "z": 0 }, "rotationOffset": { "yaw": 0, "pitch": 0, "roll": 0 } }
Camera Views
Several camera views can be defined in the "data.json" under "cameras". Each camera view can have the following parameters:

Parameter
Datsa Type
Description
location
Vector
Specifies the coordinates of the camera in centimetres as X, Y, Z, e.g. 50.5, 100, 7.32
rotation
Rotation
Specifies the default rotation of the camera in degrees for pitch, yaw and roll. e.g. 1, 45, 360
accelerationMovementFactors
Vector
This parameter can be used to specify how much centrifugal forces affect the camera while the vehicle is accelerating. Only works in combination with "applyMovementEffects".
brakingMovementFactors
Vector
This parameter allows you to specify how much centrifugal forces affect the camera while the vehicle is braking. Only works in combination with "applyMovementEffects".
movementLimitationBox
Vector
This parameter allows you to specify how much centrifugal forces affect the camera while the vehicle is braking. Only works in combination with "applyMovementEffects".
movementLimitationBox
Vector
Limits the maximum camera movement due to centrifugal forces.
type
String
Specifies which camera it is. With the exception of Additional, there should only be one camera per type. Possible camera types: DefaultCockpit, DefaultChase, DefaultHood, DefaultTopDown, Additional
restrictedByCollision
Boolean
If this value is set to true, the camera tries to avoid collisions with other objects. Only works if distanceFromRotationPoint is set to a value greater than 0.
applyMovementEffects
Boolean
Determines whether centrifugal forces act on this camera.
playerCanRotate
Boolean
Determines whether the player can rotate this camera with the mouse.
distanceFromRotationPoint
Float
If the camera is not to rotate around itself but around another point (e.g. outdoor camera), then the position of the point around which the camera rotates must be entered as the "location", instead of the position of the camera itself. The parameter "distanceFromRotationPoint" can then be used to specify how far the camera should be from the rotation point.
defaultFovDegrees
Float
Default value for the field of view.
rotationSpeed
Float
Rotation speed
slightTransitionOffset
Vector
Offset for animation when the camera changes
cockpitShoulderLookLeftAngle
Float
Angle by which the camera rotates to the left during a shoulder look.
cockpitShoulderLookLeftPositionOffset
Vector
Position offset for a left shoulder view
cockpitShoulderLookRightAngle
Float
Angle by which the camera rotates to the right during a shoulder look.
cockpitShoulderLookRightPositionOffset
Vector
Position offset for a right shoulder view
cockpitLookLeftAngle
Float
Angle by which the camera rotates when looking to the left.
cockpitLookRightAngle
Float
Angle by which the camera rotates when looking to the right.
cockpitLookBehindPositionOffset
Vector
Position offset when looking backwards
cockpitLookBehindAngle
Float
Angle by which the camera rotates when looking to the rear.
cockpitLookForwardUpPositionOffset
Vector
Position offset when looking upwards
cockpitLookForwardAngle
Vector
Angle by which the camera rotates when looking upwards.
SteeringCameraRotationFactor
Float
Multiplication factor for the angle of the steering camera
SteeringCameraCenterDeadZone
Float
Angle by which the steering wheel can be rotated before the steering wheel camera takes effect.
MaxPan
Float
Maximum angle by which the camera can be rotated horizontally. -1 for unlimited rotation
MaxTiltUp
Float
Maximum angle by which the camera can be rotated vertically upwards.
MaxTiltDown
Float
Maximum angle by which the camera can be rotated vertically downwards.
zoomAllowed
Boolean
Determines whether the player is allowed to zoom.

If a parameter is omitted, a default value is used.
Configure Power Train - Engine pt.1
Engine
The engine is configured in the drive train under "engine" and has the following parameters. It should be noted that some parameters only have an effect on a specific engine type.

Parameter
Data Type
E*
C*
Description
identifier
String
X
X
Engine type. Currently possible: default_electric, default_combustion.
maxPower
Float
X
Maximum power in kW (Kilowatt)
maxRecuperationPower
Float
X
Maximum recuperation power in kW
maxTorque
Float
X
Maximum torque in Nm (Newton meter)
maxRecuperationTorque
Float
X
Maximum recuperation torque in Nm
maxRecuperationAtRPM
String
X
Engine speed (in RPM) at which the recuperation torque should be at maximum
minRecuperationAtRPM
Float
X
Engine speed (in RPM) from which (minimum) recuperation is possible.
useCustomTorqueCurves
Boolean
X
Indicates whether a custom curve should be used for the engine torque instead of the standard calculation based on engine power
useCustomRecuperationCurve
Boolean
X
Indicates whether to use a custom curve for the recuperation force instead of the default calculation based on maxRecuperationTorque, maxRecuperationAtRPM and minRecuperationAtRPM.
minRecuperationTorqueForBrakeLight
Float
X
The brake lights are switched on if the recuperation torque exceeds this value.
minRecuperationBelowBatteryLevel
String
X
Below this battery charge level (0 to 1), (minimum) recuperation is available. If the battery charge is higher, no recuperation is possible.
maxRecuperationBelowBatteryLevel
Float
X
Below this battery charge level (0 to 1), maximum recuperation is available.
maxReversingSpeed
Float
X
X
Maximum speed when reversing. Above this speed, the engine reduces its power.
powerOutputChangeRate
Float
X
X
Determines how quickly the engine reacts to changes in the accelerator pedal position.
revUpSpeed
Float
X
Determines how fast the engine revs up.
useOnePedalDrivingThrottleResponse
String
X
Activates the special throttle mode for One Pedal Driving.
onePedalDrivingRecuperationMaxThrottlePosition
Float
X
When One Pedal Driving is active, the throttle position at which the transition between acceleration and recuperation occurs depends on the speed. At a standstill, it is at 0 (pedal released), so you do not have to overcome dead travel to get going. As speed increases, the transition shifts to the point indicated here. If, for example, the transition between acceleration and recuperation is to take place at a maximum of 50% of the accelerator pedal depressed, 0.5 must be entered here as the value.
onePedalDrivingRecuperationMaxThrottlePositionAtSpeed
Float
X
The speed at which the maximum value for the transition between acceleration and recuperation is to be reached in One Pedal Driving.
idlePower
Float
X
Engine power at idle in kW. Used for the calculation of fuel consumption.
idleRPM
Float
X
Idle Speed
idleRPMAfterColdStart
String
X
Increased idle speed after cold start.
stallRPM
Float
X
Engine speed below which the engine stalls
stallTime
Float
X
Time in seconds until engine stalls
starterTorque
Float
X
Torque of the starter motor
starterTime
Float
X
Time the engine takes to start
coolingFactor
String
X
Factor for engine cooling. If the engine tends to overheat, this value should be increased.
maxTorqueCurve
Float
X
X
see next section
minTorqueCurve
Float
X
see next section
stallingTorqueCurve
Float
X
see next section
throttleResponseCurve
Float
X
X
see next section
throttleResponseAccelerationCurve
Float
X
see next section
throttleResponseRecuperationCurve
String
X
see next section
maxRecuperationTorqueCurve
Float
X
see next section
brakeRecuperationCurve
Float
X
see next section
engineEfficiencyCurve
Float
X
see next section
throttleEfficiencyCurve
Float
X
see next section

*E = Electric; C = Combustion
Configure Power Train - Engine pt.2
Curves
Some engine parameters must be set via curves. For this purpose, corresponding assets of the type "Float Curve" must be created in the Unreal Editor. These assets can be linked to the vehicle by right-clicking on the asset and selecting "Copy Reference". This reference can then be inserted in the data.json at the corresponding parameter.

All curve types are described below with an example curve:

MaxTorqueCurve
X-axis: Engine speed in RPM

Y-axis: Engine torque in Nm

This curve contains the maximum torque of the engine as a function of the engine speed.

MinTorqueCurve
X-axis: Engine speed in RPM

Y-axis: Engine torque in Nm

This curve contains the torque of the engine when the accelerator pedal is released. Below idle speed the values should be positive, above idle speed they should be negative to simulate the engine braking effect. The further the values go into the negative range, the greater the engine braking effect. The transition between positive and negative values should ideally be right at idle speed.

StallingTorqueCurve
X-axis: Engine speed in RPM

Y-axis: Engine torque in Nm

This curve indicates the torque of the engine when no fuel is injected or the engine is stalled. Accordingly, the curve should be negative over the entire course.

ThrottleResponseCurve
X-axis: Throttle position (0 to 1)

Y-axis: Fuel injection (0 to 1) for a combustion engine or engine power (-1 to 1) for an electric car.

This curve defines how the engine reacts to the position of the accelerator pedal. Especially when the accelerator pedal is in a low position, care should be taken to ensure that sufficient power is available so that the vehicle can start well without having to overcome a longer pedal travel. In an electric car, positive values mean acceleration and negative values mean recuperation.

"ThrottleResponseAccelerationCurve" and "ThrottleResponseRecuperationCurve"
If "useOnePedalDrivingThrottleResponse" is used, two separate ThrottleResponse curves must be defined for acceleration and recuperation. The transition between the two curves is calculated automatically using the values defined in "onePedalDrivingRecuperationMaxThrottlePosition" and "onePedalDrivingRecuperationMaxThrottlePositionAtSpeed".

MaxRecuperationTorqueCurve
X-axis: Engine speed in rpm

Y-axis: torque in Nm

If "useCustomRecuperationCurve" is true, this curve can be used to define the recuperation behaviour depending on the speed.

BrakeRecuperationCurve
X-axis: Brake pedal position (0 to 1)

Y-axis: Recuperation strength (0 to 1)

With this curve, you can define how much the car recuperates depending on the brake pedal position.

EngineEfficiencyCurve
X-axis: Engine speed

Y-axis: Efficiency (0 to 1)

This curve can be used to define how the efficiency of the engine behaves in relation to the engine speed. It is used to calculate the fuel consumption.

ThrottleEfficiencyCurve
X-axis: Throttle position (0 to 1)

Y-axis: Efficiency (0 to 1)

This curve can be used to define how the efficiency of the engine behaves in relation to the throttle position. It is used to calculate the fuel consumption.

Continued in the next section.
Configure Power Train - Gearbox pt.1
Gearbox
The gearbox is configured in the drive train under "transmission" and has the following parameters. It should be noted that some parameters only have an effect on a certain gearbox type. In addition, the "default_ev_transmission" should only be combined with the "default_electric" engine and the "default_dualclutch_transmission" as well as the "default_manual_transmission" only with the "default_combustion" engine.

Parameter
Data Type
E*
D*
M*
Description
identifier
String
X
X
X
Transmission type. Currently possible: default_ev_transmission, default_dualclutch_transmission, default_manual_transmission
transmissionType
String
X
X
X
Transmission type: "Automatic" or "Manual". Should match the selected transmission
baseRatio
Float
X
X
X
The base transmission ratio of the gearbox. The final transmission ratio results from the base transmission ratio multiplied by the transmission ratio of the current gear. For the electric car, only the basic transmission ratio is used.
changeTime
Float
X
Time in seconds that the transmission needs to preselect a new gear.
efficiency
Float
X
X
X
Transmission efficiency
maxClutchTorque
Float
X
X
Maximum torque that can be transmitted by the gearbox. Should be greater than the maximum torque of the engine.
maxClutchTorqueSlipping
Float
X
X
Maximum torque that can be transmitted from the gearbox while the clutch is slipping. Should be less than "maxClutchTorque". If the car starts very rough, it may help to reduce this value a little.
clutchFullyDisengagedAtBrakePosition
Float
X
X
If the brake pedal is depressed more than this value, the transmission disengages the clutch to prevent the engine from stalling. For manual transmission, this value is only used when the automatic clutch is active.
clutchDisengagesAtSpeed
Float
X
X
Below this speed, the transmission opens the clutch to prevent the engine from stalling. With a manual transmission, this value is only used when the automatic clutch is active.
maxClutchSpeed
Float
X
X
Maximum speed at which the clutch is moved. With a manual transmission, this value is only used if the automatic clutch is active.
maxClutchSpeedGearSwitching
Float
X
Maximum speed at which the dual-clutch transmission changes from the current gear to the preselected gear.
maxClutchSpeedDifferenceForEngagingGear
Float
X
If the speed difference between the clutch and the driveline is greater than this value, no gear can be engaged.
minClutchPositionForEngagingGear
Float
X
This value (0 to 1) indicates the minimum amount of clutch pedal depression required to engage a gear.
drivingOffClutchFactor
Float
X
X
When driving off, the transmission controls the clutch in such a way that, if possible, the engine speed does not fall below a certain minimum. If this parameter is set to 0, the value corresponds to the speed at which the engine is not stalled; if it is set to 1, it corresponds to the idling speed. Values in between are also possible. This parameter has a significant influence on start-up behaviour. With a manual transmission, this value is only used if the automatic clutch is active.
drivingOffMinClutchSpeed
Float
X
The minimum speed at which the clutch is moved when starting off.
drivingOffMaxClutchSpeed
Float
X
X
The maximum speed at which the clutch is moved when starting off. With a manual transmission, this value is only used when the automatic clutch is active.
drivingOffMinRPM
Float
X
X
If this parameter is set, the engine tries to maintain the minimum speed specified here by controlling the fuel injection when driving off.
minCreepingSpeedAtIdle
Float
X
The minimum speed at which the car creeps with the gear engaged and the pedals released.
maxCreepingSpeedAtIdle
Float
X
The maximum speed at which the car creeps with the gear engaged and the pedals released.
maxAllowedRpm
Float
X
Maximum allowed engine speed. If downshifting would cause this rpm to be exceeded, the transmission will prohibit shifting
kickdownThreshold
Float
X
The throttle position (0 to 1) from which kickdown is activated. Only works if "dynamicShiftPoints" is not used.
dynamicShiftPoints
Boolean
X
If this parameter is set to true, the shift points are set dynamically based on the accelerator pedal position. Requires a corresponding curve at "dynamicShiftingThrottleResponseCurve".
Table continues in next the section
*E = default_ev_transmission, D = default_dualclutch_transmission, M = default_manual_transmission
Configure Power Train - Gearbox pt.2
Table is continued from the previous section due to character limit per section.
Parameter
Data Type
EV*
DCT*
M*
Description
dynamicShiftingThrottleResponseCurve
Reference Path
X
see below
clutchCurve
Reference Path
X
see below
useClassicGearSelectorPattern
Boolean
X
X
If this parameter is true, a classic gear selector with the arrangement P-R-N-D is simulated. If false, a non-engaging gear selector is simulated along the lines of modern cars.
automaticallyShiftToParkWhenEngineIsOff
Boolean
X
If this parameter is true, the transmission automatically shifts to P when the engine stops.
automaticallyShiftToFirstGearAtStandstill
Boolean
X
If this parameter is true and the automatic transmission is in manual mode, the first gear is automatically engaged when the vehicle is stationary.
reverseGear
-
X
X
Contains a float parameter "ratio" which specifies the gear ratio of the reverse gear.
forwardGears
Array
X
X
see below
*EV = default_ev_transmission, DCT = default_dualclutch_transmission, M = default_manual_transmission

Gears
ForwardGears
The parameter "forwardGears" is an array containing all forward gears of the transmission. A forward gear has the following parameters:

Paramter
Data Type
Description
ratio
Float
gear ratio
shiftingModes
Array
see below

ShiftingModes
A ShiftingMode contains the shifting points for a gear (at which engine speed the next or previous gear is shifted). Any number of ShiftingModes can be defined. Which ShiftingMode is active is controlled by the vehicle script. However, it is important that all gears have the same number of shifting modes. A ShiftingMode consists of the following parameters:

Paramter
Data Type
Description
shiftUpRpm
Float
Speed at which the gearbox shifts to the next gear
shiftDownRpm
Float
Speed at which the gearbox shifts to the previous gear
shiftUpRpmKickdown
Float
Speed at which the gearbox shifts to the next gear if kickdown is active
shiftDownRpmKickdown
Float
Speed at which the gearbox shifts to the previous gear if kickdown is active

Curves
"DynamicShiftingThrottleResponseCurve"
X-axis: Throttle position (0 to 1)

Y-axis: Shift point shift (0 = normal shift point, 1 = kickdown shift point).

If "dynamicShiftPoints" is active, this curve can be used to define how the shift points are to be set depending on the accelerator pedal position. 0 means that the normal shift point is used, with 1 the kickdown shift point is used. For values in between, the shift point is interpolated accordingly.

"ClutchCurve"
X-axis: Clutch pedal position (0 to 1)

Y-axis: Clutch position (0 = clutch completely open, 1 = clutch completely closed)

This curve can be used to determine how the actual position of the clutch behaves in relation to the clutch pedal. This can be used, for example, to simulate a certain dead travel in the pedal.

Differential
Paramter
Data Type
Description
type
String
Type of drive. Currently possible: FrontWheelDrive, RearWheelDrive, AllWheelDrive
frontRearSplit
Float
For all-wheel drive, this can be used to define the ratio in which the drive forces are split between the front and rear wheels.
Configure assistance systems
Various assistance systems can be configured in the "data.json" under "AssistanceSystems".

ABS
The anti-lock braking system prevents the wheels from locking during heavy braking so that the steering ability is maintained.
Parameter
Data Type
Description
available
Boolean
Determines whether the car has ABS.
minimumSpeed
Float
Minimum speed at which ABS is active.
minimumSpeedDifference
Float
If the speed difference between wheel speed and actual speed is greater than this parameter, the ABS intervenes.
regulationSpeed
Float
Determines how fast the ABS increases or decreases the braking force.

TCS
The traction control system reduces drive wheel spin by reducing engine power.
Parameter
Data Type
Description
available
Boolean
Determines whether the car has traction control.
minimumSpeedDifference
Float
If the speed difference between wheel speed and actual speed becomes greater than this parameter, the system intervenes.
reactionSpeed
Float
Determines how fast the system reduces engine power.
returnSpeed
Float
Determines how fast the engine power is released again as soon as the tyres have regained grip.

ESC
The electronic stability control attempts to reduce understeer or oversteer by braking individual wheels.
Parameter
Data Type
Description
available
Boolean
Determines whether the car has ESC
understeerDetectionTreshold
Float
Threshold above which ESC intervenes in case of understeer.
oversteerDetectionTreshold
Float
Threshold at which ESC intervenes in case of oversteer.
understeerPowerReductionFactor
Float
Factor for how much the engine power is reduced in case of understeer. 1 means no reduction, 0 means that the engine power is reduced to 0.
oversteerPowerReductionFactor
Float
Factor for how much the engine power is reduced in case of oversteer. 1 means no reduction, 0 means that the engine power is reduced to 0.
understeerMaxBrakeFactor
Float
Maximum braking force (0 to 1) with which wheels can be braked in case of understeer.
oversteerMaxBrakeFactor
Float
Maximum braking force (0 to 1) with which wheels can be braked in case of oversteer.
understeerMaxBrakingAtSkidMagnitude
Float
Skid value for understeer at which the maximum braking force becomes effective. The lower this value is selected, the more strongly ESC intervenes even at slight understeer.
oversteerMaxBrakingAtSkidMagnitude
Float
Skid value for oversteer at which the maximum braking force becomes effective. The lower this value is selected, the more ESC intervenes even at slight oversteer.
powerRegulationSpeed
Float
Determines how fast ESC can reduce engine power.
brakeRegulationSpeed
Float
Determines how fast ESC can build up braking power.

AutoHold
Autohold causes the brake to remain active when the car is at a standstill so that the brake pedal can be released without the car rolling away.
Parameter
Data Type
Description
available
Boolean
Determines whether the car has auto-hold.
activateBelowSpeed
Float
Speed below which Autohold activates at the earliest.
activateAtBrakePosition
Float
Value (0 to 1) of how hard the brake pedal must be depressed for Autohold to activate.
deactivateAtThrottlePosition
Float
Value (0 to 1), how strongly the accelerator pedal must be depressed for the brake to be released again.
minimumBrakeForce
Float
Minimum brake force (0 to 1) with which Autohold applies the brake.

HillStartAssistant
The hill start assistant assists when starting uphill by not releasing the brake until sufficient engine power is available to start the vehicle.
Parameter
Data Type
Description
available
Boolean
Determines whether the car has hill start assist.
minimumGradient
Float
Minimum gradient at which the hill start assist is active.
minimumBrakePosition
Float
Minimum position of the brake pedal (0 to 1) at which the hill start assist is activated.
releaseFactor
Float
This factor can be used to influence how early the brake is released. With smaller values, the brake is already released when the available engine power is only minimally higher than required; with larger values, it is released later. If the values are too small, the brake may be released too early.
Vehicle lights
Preparations on the 3D model
Each lamp that is to be lit independently of other lamps must be assigned its own MaterialSlot. Lamps that are to light up at the same time and in the same colour can be assigned the same MaterialSlot. For example, it is possible to assign the same material to all turn signals on the right side of the vehicle, but not to the turn signals on both sides.

Furthermore, all lamps must be located in a mesh that is assigned to the vehicle as an attachment. They must not be on the chassis mesh. However, it is possible to combine lamps with other attachments in one mesh, e.g. lamps mounted on the boot lid can be on the same mesh as the boot lid itself.

The material that is assigned to a lamp must have a material parameter that can be used to control the brightness.

Attachment parameters
In order to control the lamps, it is necessary to assign names to the corresponding MaterialSlots. For this purpose, there is the attachment parameter "dynamicMaterialIndices". This is an array that contains corresponding assignments according to the following scheme:

"MaterialName": MaterialSlot

MaterialName stands for the name assigned to this MaterialSlot and MaterialSlot for the index of the material slot.

Example
{ "name": "Lights", "meshReferencePath": "StaticMesh'/Game/Vehicles/Cars/Ferrari_488_GTB/Meshes/Ferrari_488_GTB_Lights.Ferrari_488_GTB_Lights'", "target": "jnt_Car_root", "dynamicMaterialIndices": { "LowBeamMaterial": 6, "FrontLeftIndicatorLightMaterial": 7, "DayDrivingLightMaterial": 4, "RearLightMaterial": 10, "BrakingLightMaterial": 1, "FrontRightIndicatorLightMaterial": 5, "ReversingLightMaterial": 9, "FogLightMaterial": 11 } }

Light sources
In order for the headlights to illuminate the surroundings, it is necessary to define corresponding light sources. For this purpose, there are the section "Lights" in the "default.json", which can contain any number of light sources. A light source first has a name and then consists of the following parameters:
Parameter
Datay Type
Description
type
String
Type of light source. Currently possible: Point, Spot
position
Vector
Position of the light source.
rotationOffset
Rotation
Rotation of the light source.
intensity
Float
Brightness
attenuationRadius
Float
Range
innerConeAngle
Float
Inner angle of the light cone
outerConeAngle
Float
Outer angle of the light cone
castsShadows
Boolean
Determines whether this light source creates shadows when it hits other objects (affects performance)
affectsWorld
Boolean
Determines whether this light source illuminates the environment.
color
RGB
Light colour in Red, Green and Blue values from 0 to 255

Example
"Lights": [ { "HeadlightR": { "type": "Spot", "position": { "x": 185.8, "y": 70.4, "z": 59.74 }, "rotationOffset": { "yaw": 0, "pitch": -15, "roll": 0 }, "intensity": 200.0, "attenuationRadius": 5000.0, "innerConeAngle": 0.0, "outerConeAngle": 30.0, "castsShadows": false, "affectsWorld": true, "color": { "r": 234, "g": 231, "b": 226 } }, "HeadlightL": { "type": "Spot", "position": { "x": 185.8, "y": -70.4, "z": 59.74 }, "rotationOffset": { "yaw": 0, "pitch": -15, "roll": 0 }, "intensity": 200.0, "attenuationRadius": 5000.0, "innerConeAngle": 0.0, "outerConeAngle": 30.0, "castsShadows": false, "affectsWorld": true, "color": { "r": 234, "g": 231, "b": 226 } } } ]

Control lights in script
MaterialParameter
Scalar
Materials can be controlled in the vehicle script by calling setMaterialParameterScalar(Attachment, Material, Parameter, Value) for scalar parameters. Attachment is the name of the attachment, Material is the material name assigned in the attachment, Parameter is the name of the MaterialParameter to be controlled and Value is the value to which the MaterialParameter is to be set.

Example
setMaterialParameterScalar("Lights", "BrakeLightMaterial", "Emissive", 1.0)

Vector
Vector parameters can be changed by calling setMaterialParameterVector(Attachment, Material, Parameter, ValueR, ValueG, ValueB, ValueA). The functionality is essentially the same as for scalar parameters, with the only difference that Value consists of 4 variables.

Example
setMaterialParameterVector("Lights", "BrakeLightMaterial", "Emissive", 1.0, 0.5, 0.5, 1.0)

Light sources
The brightness of light sources can be controlled by calling setLightIntensity(Name, Value) in the script. Name is the name of the light source in "default.json" and Value is the value to which the brightness should be set.

Example
setLightIntensity("HeadlightL", 150.0)
Mirrors
Material
For rear view mirrors, a material must first be created in Unreal according to the following template:

Depending on how the mirrors are mapped in the 3D model, it may be necessary to enter either 1.0 or -1.0 for UTiling so that the mirrors are rendered "the right way round".

Render Target
For each mirror present on the vehicle, a separate RenderTarget must be created in Unreal. The size of the RenderTarget should be set so that the aspect ratio matches the mirror mapping so that the mirror image is not distorted.

Material Instances
For each mirror, a separate Material Instance must be created with the previously created mirror material as the parent. The respective previously created RenderTarget is entered as the MaterialParameter "RenderTarget". The Material Instances created in this way must then be assigned to the respective mirror meshes as material.

Attachment parameters
Finally, the mirrors must be entered in the "default.json" for the respective attachments. For this purpose, there is the parameter "sceneCapture", which in turn has the following parameters:

Parameter
Data Type
Description
enabled
Boolean
Determines whether this mirror is active.
targetTextureReferencePath
Reference Path
Reference to the corresponding RenderTarget. Can be obtained by right-clicking on the RenderTarget and selecting "Copy Reference".
rotationOffset
Rotation
Rotation offset from the rotation of the bone to which the attachment is attached.
positionOffset
Vector
Position offset from the position of the bone to which the attachment is attached.
projectionFov
Float
Field Of View

Example
{ "name": "RightSideMirrorGlass", "meshReferencePath": "StaticMesh'/Game/Vehicles/User/Cars/Tesla_Model_3/Meshes/SM_Tesla_Model_3_Door_SideMirrorSurface_R.SM_Tesla_Model_3_Door_SideMirrorSurface_R'", "target": "jnt_SideMirror_R", "sceneCapture": { "enabled": true, "targetTextureReferencePath": "TextureRenderTarget2D'/Game/Vehicles/User/Cars/Tesla_Model_3/Materials/Textures/T_Tesla_Model3_SideMirror_Right.T_Tesla_Model3_SideMirror_Right'", "rotationOffset": { "yaw": -195, "pitch": 0, "roll": 0 }, "positionOffset": { "x": -22, "y": 0, "z": 0 }, "projectionFov": 45 } }
Scripting - Functions pt.1
Basics
Many aspects of the vehicle (e.g. lighting, animations, ...) can be controlled via scripts. Lua is used as the scripting language. Any number of scripts can be created as .lua files in the "scripts" subfolder of the vehicle folder.

Functions called by the game
The following functions can be created in the script and will be called by the game when certain events occur.

onLoad()
Called when the script is loaded

onSpawn()
Called when the vehicle is spawned

onButtonChanged(String Name, ButtonChangeType Type)
Called when a button on the mouse, keyboard, steering wheel or gamepad for which a mapping exists is pressed or released.

Name: Name of the mapping

Type: Indicates whether the mapping is pressed or released. Possible values: BUTTON_PRESSED, BUTTON_RELEASED

onVehicleUpdate(VehicleTickData Data)
Called every frame

Data: State of the vehicle

onAttachmentInteract(String InteractionName, bool Secondary, bool Pressed)
Called when an attachment is interacted with.

InteractionName: Name of the interaction

Secondary: Is true if it is the secondary interaction.

Pressed: Is true if the interaction key has been pressed and false if the interaction key has been released.

onDynamicDisplayInteract(String DisplayName, String AttachmentName, Bool Pressed, Float CoordinateX, Float CoordinateY)
This function in the script is called whenever a display is interacted with.

DisplayName: Name of the display being interacted with.

AttachmentName: Name of the attachment to which the display is assigned. This distinction is important if there are displays in several attachments that have the same name.

Pressed: Is true if the interaction key was pressed and false if the interaction key was released.

CoordinateX: X-coordinate of the position in pixels where the display was clicked.

CoordinateY: Y-coordinate of the position in pixels where the display was clicked.

onAnimationFinished(int AnimationId)
Called when an animation has finished playing.

AnimationId: Id of the played animation.

onVehicleInitialize(VehicleDefinition Definition, VehicleProfile Profile, VehicleEngineDescription Engine, VehicleTransmissionDescription Transmission)
Called when the vehicle is initialised

Definition: Vehicle definition

Profile: Vehicle profile data

Engine: Engine definition

Transmission: Transmission definition

onVehicleOccupancyChanged(int NumOccupants)
Called when the number of persons in the vehicle has changed.

NumOccupants: Number of persons

onReceive(LuaValue Topic, LuaValue Param)
Used for communication between different scripts. Called when another script calls publish(LuaValue Topic, LuaValue Argument).

Topic: Topic

Argument: Data sent with the topic.

onCrossMenuChanged(String Function, String State)
Called when a vehicle function is called in the cross menu.

Function: Name of the function

State: New state of the function

Functions that can be called from the script
The following functions can be called from scripts. Functions for drawing displays and playing sounds are in separate chapters for clarity.

Since variables in Lua have no explicit data type and each function can be called with any data type, it is noted with each function which data types the function expects for correct functioning. "LuaValue" means that the function accepts any data type for this variable

playBoneRotationAnimation(String BoneName, FunctionType FunctionType, Vector From, Vector To, Float Duration, Float InitialDelay)
This function can be used to apply a rotation animation to a bone.

BoneName: Name of the bone

FunktionType: Type of animation function. Possible values: AINM_LINEAR, ANIM_CUBIC, ANIM_EASE_IN, ANIM_EASE_OUT

From: Start rotation

To: Target rotation

Duration: Animation duration

InitialDelay: Delay before the animation is played. If this value is 0 or omitted, the animation starts immediately.

playBoneLocationAnimation(String BoneName, FunctionType FunctionType, Vector From, Vector To, Float Duration, Float InitialDelay)
This function can be used to apply a location animation to a bone.

BoneName: Name of the bone

FunktionType: Type of animation function. Possible values: AINM_LINEAR, ANIM_CUBIC, ANIM_EASE_IN, ANIM_EASE_OUT

From: Start rotation

To: Target rotation

Duration: Animation duration

InitialDelay: Delay before the animation is played. If this value is 0 or omitted, the animation starts immediately.

setBoneRotation(String BoneName, Number X, Number Y, Number Z)
This function sets the rotation of a bone directly.

BoneName: Name of the bone

X: X-coordinate of the new rotation

Y: Y-coordinate of the new rotation

Z: Z-coordinate of the new rotation

setBoneLocation(String BoneName, Number X, Number Y, Number Z)
This function sets the position of a bone directly.

BoneName: Name of the bone

X: X-coordinate of the new position

Y: Y-coordinate of the new position

Z: Z-coordinate of the new position

setBoneLocationAndRotation(String BoneName, Number LocationX, Number LocationY, Number LocationZ, Number RotationX, Number RotationY, Number RotationZ)
This function sets the position and rotation of a bone directly.

BoneName: Name of the bone

LocationX: X-coordinate of the new position

LocationY: Y-coordinate of the new position

LocationZ: Z-coordinate of the new position

RotationX: X-coordinate of the new rotation

RotationY: Y-coordinate of the new rotation

RotationZ: Z-coordinate of the new rotation

setData(String Key, LuaValue Value)
With this function, a script can save data which is also retained in a SaveGame. The corresponding key must first be initialised with initializeData.

Key: Name under which the data is saved.

Value: Data to be saved. Possible data types: Bool, Int, Number, String

initializeData(String Key, LuaValue Value)
This function can be used to initialise fields for saving data.

Key: Name under which the data is saved.

Value: Initial value. Is only set if the field does not yet exist. Possible data types: Bool, Int, Number, String

getData(String Key)
This function can be used to retrieve stored data.

Key: Name under which the data was saved.

toggleBoolData(LuaValue Key)
With this function stored data of the type Boolean can be inverted.

Key: Name under which the data was saved.

dataExists(LuaValue Key)
This function can be used to query whether data has been saved using this key.

Key: Name under which the data was saved.

setMaterialParameterScalar(String AttachmentName, String MaterialName, String ParameterName, Float NewValue)
With this function, a scalar material parameter can be set. The prerequisite is that the material has been registered in the attachment using the parameter dynamicMaterialIndices.

AttachmentName: Name of the attachment

MaterialName: Name of the material as entered under dynamicMaterialIndices.

ParameterName: Name of the material parameter

NewValue: Value to which the parameter is set.

Continued in the next section.
Scripting - Functions pt.2
Continued from the previous section.

setMaterialParameterVector(String AttachmentName, String MaterialName, String ParameterName, Float NewValueR, Float NewValueG, Float NewValueB, Float NewValueA)
With this function, a vector material parameter can be set. The prerequisite is that the material has been registered in the attachment using the parameter dynamicMaterialIndices.

AttachmentName: Name of the attachment

MaterialName: Name of the material as entered under dynamicMaterialIndices.

ParameterName: Name of the material parameter

NewValueR: R-component of the parameter

NewValueG: G-component of the parameter

NewValueB: B-component of the parameter

NewValueA: A-component of the parameter

publish(LuaValue Topic, LuaValue Argument)
This function can be used for communication between scripts. When this function is called, the function onReceive is called in all scripts that have subscribed to the corresponding topic.

Topic: Topic

Argument: Data sent with the topic. Can be any Lua data type.

subscribe(LuaValue Topic)
This function allows the script to subscribe to a topic. This will notify the script via the on Receive function when another script calls the publish function with this topic.

Topic: Topic

setBillboardTrigger(String Name, Bool Visible)
With this function, billboards can be shown or hidden.

Name: Name of the billboard

Visible: Determines whether the billboard should be visible.

disableAssistanceSystem(String System, Bool Disabled)
With this function, individual assistance systems can be disabled or enabled.

System: Name of the assistance system to be disabled/enabled. Possible values: ABS, TCS, ESC, AutoHold, HillStartAssistant.

Disabled: Determines whether the system should be disabled or enabled. True deactivates the system, and false reactivates it.

toggleEngineButton(Bool Value)
This function allows the script to tell the engine whether the button for starting or stopping the engine is pressed.

Value: Determines whether the button is pressed.

setTransmissionManualShiftingMode(Bool Enabled)
This function can be used to set whether the automatic transmission should be in manual or automatic shifting mode, whereby only one of the two is always active when this function is used. If manual and automatic shifting is to be allowed at the same time, the setTransmissionManualShiftingAllowed and setTransmissionAutomaticShiftingAllowed functions should be used instead.

Enabled: True means that only manual shifting is allowed, and false means that only automatic shifting is allowed.

toggleTransmissionManualShiftingMode()
This function can be used to toggle the automatic transmission between manual and automatic shifting modes. When this function is used, only one of the two is active at a time. If manual and automatic shifting is to be allowed at the same time, the setTransmissionManualShiftingAllowed and setTransmissionAutomaticShiftingAllowed functions should be used instead.

setTransmissionManualShiftingAllowed(Bool Allowed)
This function can be used to set whether the automatic transmission allows the manual shifting of gears.

Allowed: Sets whether manual shifting is allowed.

setTransmissionAutomaticShiftingAllowed(Bool Allowed)
This function can be used to set whether the automatic transmission shifts gears automatically.

Allowed: Sets whether automatic shifting is allowed.

setTransmissionShiftingMode(Int Mode)
This function can be used to select which shifting mode the transmission should use.

Mode: Index of the ShiftingMode to be used

requestGearDown(Bool Value)
This function can be used to request the gearbox to shift down a gear. Only works with manual transmission or if the manual shift mode is active.

Value: Indicates whether the gear change is requested.

requestGearUp(Bool Value)
This function can be used to request the transmission to shift up a gear. Only works with manual transmission or if manual shift mode is active.

Value: Indicates whether the gear change is requested.

requestDriveModeDown(Bool Value)
This function can be used to request the transmission to downshift a drive mode (P-R-N-D). Only works for automatic transmission or electric cars.

Value: Indicates whether the change is requested.

requestDriveModeUp(Bool Value)
This function can be used to request the transmission to shift up a drive mode (P-R-N-D). Only works with automatic transmission or electric cars.

Value: Indicates whether the change is requested.

requestDriveModeOrGearDown(Bool Value)
This function can be used to request the transmission to shift down a drive mode (P-R-N-D) or gear.

Value: Indicates whether the change is requested.

requestDriveModeOrGearUp(Bool Value)
This function can be used to request the transmission to shift up a drive mode (P-R-N-D) or a gear.

Value: Indicates whether the change is requested.

requestGearPark(Bool Value)
This function can be used to request the gearbox to activate the park mode.

Value: Indicates whether the park mode is requested.

limitEngineTorque(Number Value)
This function can be used to limit the maximum torque of the engine.

Value: maximum torque in Nm. 0 means no limit.

setLightIntensity(String Name, Float Intensity)
With this function, the brightness of a light source can be set.

Name: Name of the light source

Intensity: Brightness

isPlayerInVehicle()
This function can be used to query whether the player camera is currently in the interior view or in an exterior view. The function returns a boolean that is true if the camera is in the interior view.

setAttachmentVisibility(String Name, Bool Visible)
This function sets the visibility of an attachment.

Name: Name of the attachment

Visible: Whether the attachment should be visible

updateCrossMenu(String Function, String State)
This function notifies the cross menu that the state of a vehicle function has changed.

Function: Name of the function

State: New state

setHandbrake(Float Value)
This function sets the handbrake of the vehicle.

Value: Position of the handbrake: 0 = completely released, 1 = completely applied.

getLineTraceDistance(String BoneName, Vector StartOffset, Vector EndOffset)
This function can be used to perform a LineTrace, e.g. for parking sensors. The function returns the distance from the starting point to the first collision.

BoneName: Name of the bone used as a reference for the coordinates.

StartOffset: Start position of the LineTrace relative to the position of the bone.

EndOffset: End position of the LineTrace relative to the position of the bone.

setMinimumBrake(Float Value)
This function sets the brake to a certain minimum value.

Value: Minimum value to set the brake to (0 bis 1)

enableSceneCapture(String AttachmentName, Bool Enable)
This function disables or enables a SceneCapture (used for mirrors or cameras). For example, this can be used to only enable the rearview camera, when reverse gear is engaged for better performance.

AttachmentName: Name of the attachment, where the SceneCapture is defined

Enable: Whether the SceneCapture should be enabled

Continued in the next section.
Scripting - Functions pt.3
Continued from the previous section.

musicPlayerOpenPlaylist(String Name)
This function opens a playlist or a radio station.

Name: Name of the playlist or radio station

musicPlayerPlay()
Sets the Music Player to Play.

musicPlayerPause()
Sets the Music Player to Pause.

musicPlayerPlayPause()
Toggles play or pause.

musicPlayerNext()
Switch to the next song. Doesn't work, if a radio station is playing.

musicPlayerPrevious()
Switch to the previous song. Doesn't work, if a radio station is playing.

musicPlayerNextPlaylist()
Switch to the next playlist. Ignores radio stations.

musicPlayerPreviousPlaylist()
Switch to the previous playlist. Ignores radio stations.

musicPlayerNextRadioStation()
Switch to the next radio station. Ignores playlists.

musicPlayerPreviousRadioStation()
Switch to the previous radio station. Ignores playlists.

musicPlayerNextPlaylistOrRadioStation()
Switch to the next playlist or radio station.

musicPlayerPreviousPlaylistOrRadioStation()
Switch to the previous playlist or radio station.

musicPlayerSeekPercentage(Float Value)
Seek a certain position in the current song.

Value: Position to seek: 0 is at the beginning of the song, and 1 is at the end.

musicPlayerSetLoop(Bool Value)
Sets the Music Player's loop function, so that it loops the current playlist.

Value: Whether the loop function should be enabled

musicPlayerToggleLoop()
Toggles the Music Player's loop function, so that it loops the current playlist.

musicPlayerSetLoopOneSong(Bool Value)
Sets the Music Player's loop function, so that it loops the current song.

Value: Whether the loop function should be enabled

musicPlayerToggleLoopOneSong()
Toggles the Music Player's loop function, so that it loops the current song.

musicPlayerSetShuffle(Bool Value)
Sets the Music Player's shuffle function, so that it selects random songs from the current playlist.

Value: Whether the shuffle function should be enabled

musicPlayerToggleShuffle()
Toggles the Music Player's shuffle function, so that it selects random songs from the current playlist.

musicPlayerSetVolume(Float Value)
Sets the Music Player's audio volume.

Value: Value (0 to 1) to set the volume to.

musicPlayerIncreaseVolume(Float Value)
Increases the Music Player's audio volume by a certain amount.

Value: Value, by which the volume should be increased

musicPlayerDecreaseVolume(Float Value)
Decreases the Music Player's audio volume by a certain amount.

Value: Value, by which the volume should be decreased

musicPlayerSetOutsideEffect(Bool Value)
This function tells the Music Player, whether the player is currently outside of the vehicle so that the music sounds more muffled.

Value: Determines whether the effect should be active. This value should be true if the player is outside of the vehicle and all windows and doors are closed.

Continued in the next section with Datatypes.
Scripting - Data Types pt.1
Data Types
VehicleTickData
VehicleTransmissionState Transmission: State of the gearbox

VehicleEngineState Engine: State of the engine

VehicleAssistanceSystemsState AssistanceSystems: State of the assistance systems

EnvironmentState Environment: State of the environment

VehiclePlayerInputs Inputs: Player inputs through input devices. Note: Inputs via the cross-menu or by interacting with vehicle attachments are not considered here.

Float DeltaSeconds: Time in seconds since the last tick

Float Speed: Vehicle speed in km/h

Float AverageSteerAngle: Average steering angle

Float SteeringWheelAngle: Steering angle

Vector Acceleration: Acceleration forces acting on the vehicle

Array<Rotator> WheelAnimationRotations

Array<Float> MotionBlurFactor

Array<Rotator> TireAnimationRotations

Array<Vector> WheelAnimationRotations

Array<Vector> WheelAnimationTranslations

Float ResourceLevel: Fill level of the tank or battery

Bool InTunnel: Is the vehicle in a tunnel?

Bool InUnderpass: Is the vehicle in an underpass?

Float DrivenMeters: Distance in metres that the vehicle has travelled in total.

Float DrivenMetersSinceStart: Distance in metres that the vehicle has travelled since the start of the game.

MusicPlayerTickData MusicPlayer: State of the music player.

VehicleTransmissionState
Float Torque: Torque output of the gearbox

Int GearIndex: Currently engaged gear

Float ClutchPosition: Current position of the clutch

int DriveModeIndex: Index of the current drive mode

Array<Int> AllowedDriveModes: Currently allowed drive modes

Float CurrentGearRatio: Current gear ratio of the gearbox

Float ClutchSpeed: Clutch speed

Float ClutchTorque: Clutch torque

Bool ClutchIsSlipping: Is the clutch currently slipping?

Float ClutchEngineSpeedDifference: Difference between engine speed and clutch speed

Bool SwitchingGearFailed: This is true if engaging a gear failed, e.g. because the clutch was not sufficiently depressed or the speed difference is too great.

Bool AutomaticShiftingAllowed: Is the transmission currently allowed to shift gears automatically?

Bool ManualShiftingAllowed: Is the player currently allowed to manually shift gears in the automatic transmission?

Int SelectedShiftingMode: Index of the currently selected shifting mode.

Bool ManualUpshiftingInputReceived: This is true if the transmission has received a request to manually shift up a gear. Can be used, for example, to animate gearshift paddles.

Bool ManualDownshiftingInputReceived: This is true if the transmission has received the request to manually shift down a gear. Can be used, for example, to animate gearshift paddles.

Bool DriveModeUpInputReceived: This is true if the transmission has received the request to shift up a drive mode (P-R-N-D). Can be used, for example, to animate gearsticks.

Bool DriveModeDownInputReceived: This is true if the transmission has received the request to downshift a drive mode (P-R-N-D). Can be used, for example, to animate gearsticks.

Bool GearshiftInProgress: This is true if a gear shift is currently taking place in the automatic transmission.

VehicleEngineState
Float RevolutionsPerMinute: Revolutions per minute of the engine.

Float CurrentPower: Current engine torque in Nm

Float EngineTemperature: Current cooling water temperature in °C

Bool RecuperationBrakeLight: Is the recuperation currently so strong that the brake light should be switched on?

Float FuelInjection: Current fuel injection (0 to 1)

Bool EngineStarter: Is the starter currently active?

Bool On: Is the engine currently running?

Float LimitTorque: Value to which the engine torque is currently limited. 0 means no limit.

VehicleAssistanceSystemsState
Bool ABSDisabled: Is ABS currently disabled?

Bool ABSIntervention: Is ABS currently active?

Bool TCSDisabled: Is Traction Control currently disabled?

Bool TCSIntervention: Is Traction Control currently active?

Bool ESCDisabled: Is ESC currently disabled?

Bool ESCIntervention: Is ESC currently active?

Bool AutoHoldDisabled: Is Autohold currently disabled?

Bool AutoHoldActive: Is Autohold currently active?

Bool HillStartAssistantDisabled: Is the hill start assistant currently disabled?

Bool HillStartAssistantActive: Is the hill start assistant currently active?

EnvironmentState
DateTimeLuaState DateTimeLua: Time formatted for Lua (will probably also include the date later).

Float SunBrightness: Brightness of the sun

DateTimeLuaState
Hour: Hour

Minute: Minute

Second: Second

VehiclePlayerInput
Float ThrottleInput: Throttle input (0 to 1)

Float BrakeInput: Brake input(0 to 1)

Float SteeringInput: Steering input (-1 to 1)

Float ClutchInput: Clutch input (0 to 1)

Bool DriveModeUpRequested: Next drive mode requested

Bool DriveModeDownRequested: Previous drive mode requested

Bool DriveModeParkRequested: Park mode requested

Bool DriveModeOrGearUpRequested: Next drive mode or gear requested

Bool DriveModeOrGearDownRequested: Previous drive mode or gear requested

Bool GearUpRequested: Next gear requested

Bool GearDownRequested: Previous gear requested

Int RequestedGearIndex: Requested gear index

Bool GearRequested: True, if the player has just requested a certain gear

Bool ToggleEngine: Engine start/stop button pressed

Bool AutoClutch: Automatic clutch enabled

VehicleDefinition
VehicleMetaDefinition Meta: Vehicle Metadata

Map<VehicleAppearanceProperty, VehicleAppearanceDefinition> AppearanceDefinitions: Vehicle appearance definitions

Guid Id: Id (Guid = Global unique identifier)

String SkeletonReferencePath: Skeleton reference path

Map<String, VehicleCameraDefinition> Cameras: Camera definitions

VehiclePowerTrainDefinition PowerTrain: Power Train definition

Guid SelectedProfileId: Id of the selected profile

VehicleAssistanceSystemsDefinition AssistanceSystems: Assistance systems definition

Array<VehicleCrossMenuFunctionDefinition> CrossMenuFunctions: Cross-menu functions

VehicleMetaDefinition
String Manufacturer: Manufacturer

String Model: Model name

String Author: Author

String Version: Version

String Description: Short description of the vehicle

Bool PlayerDriveable: Can this vehicle be driven by the player?

String Category: Vehicle type. Possible values: Sedan, Coupe, SportsCar, StationWagon, Hatchback, Convertible, Suv, MiniVan, PickUp, Other

VehiclePowerTrainDefinition
VehicleEngineDefinition Engine: Engine definition

VehicleTransmissionDefinition Transmission: Gearbox definition

VehicleDifferentialDefinition Differential: Differential definition

Continued in the next section.
Scripting - Data Types pt.2
VehicleEngineDefinition
Defines an engine. For a description see the section "Configure Power Train".

String Identifier

Float MaxPower

Float MaxRecuperationPower

Float MaxTorque

Float RecuperationEfficiency

Bool UseCustomTorqueCurves

Bool UseCustomRecuperationCurves

Float MinRecuperationTorqueForBrakeLight

Float MaxReversingSpeed

Float PowerOutputChangeRate

Float RevUpSpeed

Bool UseOnePedalDrivingThrottleResponse

Float OnePedalDrivingRecuperationMaxThrottlePositionAtSpeed

Float IdlePower

Float IdleRPM

Float IdleRPMAfterColdStart

Float StallRPM

Float StallTime

Float StarterTorque

Float StarterTime

Float CoolingFactor

String MaxTorqueCurve

String ThrottleResponseCurve

String ThrottleResponseAccelerationCurve

String ThrottleResponseRecuperationCurve

String MaxRecuperationCurve

String BrakeRecuperationCurve

String MinTorqueCurve

String StallingTorqueCurve

String EngineEfficiencyCurve

String ThrottleEfficiencyCurve


VehicleTransmissionDefinition
Defines a gearbox. For a description see the section "Configure Power Train".

String Identifier

VehicleTransmissionType TransmissionType

Float BaseRatio

Float ChangeTime

Float Efficiency

Float MaxClutchTorque

Float MaxClutchTorqueSlipping

Float ClutchFullyDisengagedAtBrakePosition

Float ClutchDisengagesAtSpeed

Float MaxClutchSpeed

Float MaxClutchSpeedGearSwitching

Float MaxClutchSpeedDifferenceForEngagingGear

Float DrivingOffClutchFactor

Float DrivingOffMaxClutchSpeed

Float DrivingOffMinClutchSpeed

Float DrivingOffMinRPM

Float DrivingOffMaxRPM

Float MinCreepingSpeedAtIdle

Float MaxCreepingSpeedAtIdle

Float MaxAllowedRpm

Float KickdownTreshold

Bool DynamicShiftPoints

VehicleGearDefinition ReverseGear

Array<VehicleGearDefinition> ForwardGears

String DynamicShiftingThrottleResponseCurve

String ClutchCurve

Bool AutomaticallyShiftToParkWhenEngineIsOff

Bool AutomaticallyShiftToFirstGearAtStandstill

Bool UseClassicGearSelectorPattern


VehicleDifferentialDefinition
String Type: Type. Possible values: AllWheelDrive, FrontWheelDrive, RearWheelDrive

Float FrontRearSplit: Drive force distribution front/rear with all-wheel drive

VehicleAssistanceSystemsDefinition
Defines assistance systems. For a description see Configure assistance systems.

VehicleABSDefinition ABS

VehicleTCSDefinition TCS

VehicleESCDefinition ESC

VehicleAutoHoldDefinition AutoHold

VehicleHillStartAssistantDefinition HillStartDefinition


VehicleCrossMenuFunctionDefinition
Defines a cross-menu function. For a description see Cross Menu.

String Category

String Name

Array<String> States

Int DefaultState

String Icon


VehicleProfile
VehicleProfileMeta Meta: Vehicle profile metadata

Map<VehicleAppearanceProperty, VehicleAppearancePropertyValues> Appearence: Appearance

VehicleResourcesDefinition Resources: Resources definitions

VehicleSteeringDefinition Steering: Steering definition

VehicleChassisDefinition Chassis: Chassis definition

Array<VehicleWheelDefinition> Wheels: Wheel Definition

Array<VehicleAttachmentDefinition> Attachments: Attachment definitions

Map<String, VehicleLightDefinition> Lights: Lightsource definition

Map<String, VehiclePostProcessingVolumeDefinition> PostProcessingVolumes: PostProcessingVolume definitions

Array<VehicleLightBillboardDefinition> Billboards: Billboard definitions

VehicleProfileMeta
String Name

Guid Id

Guid VehicleId

Bool bIsDefault

Bool bIsValid

String Path

DateTime LastModificationDate


VehicleResourcesDefinition
Float MaxEngineResourceLevel

VehicleSteeringDefinition
Float InputRatio

VehicleChassisDefinition
String MeshReferencePath

Float Width

Float Length

Float Height

Float Mass

Float DragCoefficient

Float DownforceCoefficient

Vector CenterOfMassOffset


VehicleWheelDefinition
String MeshReferencePath

String MeshReferencePathForMotionBlur

Bool StationaryMeshAlwaysVisible

Bool StationaryMeshCustomDepth

Bool MotionBlurMeshStatic

Float MotionBlurTreshold

Float MotionBlurRange

Float MotionBlurScale

String VerticalPosition

String HorizontalPosition

Vector Offset

Bool AffectedByEngine

Bool AffectedByBrake

Bool AffectedBySteering

Bool AffectedByHandBrake

Float RimRadius

Float Radius

Float Width

Float FrictionForceMultiplier

Float CorneringStiffness

Float SideSlipModifier

Float SlipThreshold

Float SkidThreshold

Float SpringRate

Float SpringPreload

Vector SuspensionAxis

Vector SuspensionForceOffset

Float SuspensionMaxRaise

Float SuspensionMaxDrop

Float SuspensionDampingRatio

Float SuspensionSmoothing

Float WheelLoadRatio

Float RollbarScaling

Float MaxSteerAngle

Float MaxBrakeTorque

Float MaxHandBrakeTorque

Float MaxBrakeSpeed


VehicleAttachmentDefinition
String Name

String MeshReferencePath

Array<VehicleAttachmentMaterialOverrideDefinition> MaterialOverrides

String Target

String Role

Vector PositionOffset

Rotator RotationOffset

Bool TriggerClickEvent

Map<String, Int> DynamicMaterialIndices

Map<String, String> DynamicMaterialSlotNames

Array<VehicleDynamicDisplayDefinition> DynamicDisplays

VehicleInteractionDefinition Interaction

VehicleAttachmentSceneCaptureDefinition

Map<String, Int> CustomDataInts


VehicleAttachmentMaterialOverrideDefinition
String SlotName

Int SlotIndex

String MaterialReferencePath


VehicleDynamicDisplayDefinition
String Name

Vector Offset

Vector Scale

Rotator RotationOffset

Vector2D Resolution

Bool ContainsNavigation

Vector2D NavigationResolution


VehicleInteractionDefinition
Bool Interactable

String Identifier

Vector InfoOffset

Rotator InfoRotationOffset

String InfoText

String SecondaryInfoText

Bool AllowLongInteraction

Bool SupportSecondaryInteraction


VehicleAttachmentSceneCaptureDefinition
Bool Enabled

String TargetTextureReferencePath

Vector PositionOffset

Rotator RotationOffset

Float ProjectionFov


VehicleLightDefinition
String Type

Vector Position

Rotator Rotation

Float Intensity

Float AttenuationRadius

Bool CastsShadows

Bool AffectsWorld

LinearColor Color

Float InnerConeAngle

Float OuterConeAngle


VehiclePostProcessingVolumeDefinition
Vector Position

VehicleEngineDescription
String Identifier: Engine identifier

VehicleEngineType Type: Engine type. Possible values: Combustion, Electric, Other

Map<String, LuaValue> Parameters: Engine parameters

VehicleTransmissionDescription
String Identifier

VehicleTransmissionType Type

Array<VehicleGearDescription> Gears

Array<VehicleEngineDriveModeDescription> DriveModes

Map<String, LuaValue> Parameters
Scripting - Data Types pt.3
MusicPlayerTickData
Bool IsPlaying: Whether the music player is currently playing

Bool IsLooping: Whether the loop function is currently active

Bool IsLoopingOneSong: Whether the loop function for one song is currently active

Bool IsShuffled: Whether the shuffle function is currently active

Array<String> AvailablePlaylists: Contains all available playlists

Array<String> AvailableRadioStations: Contains all available radio stations

Array<String> AvailablePlaylistsAndRadioStations: Contains all available playlists and radio stations

String PlaylistName: The name of the current playlist or radio station

String Artist: The artist of the current song. This value is empty while playing a radio station.

String Title: The title of the current song. This value is empty while playing a radio station.

Float TrackLength: The length in seconds of the current song. This value is empty while playing a radio station.

Float TrackTime: The playback time of the current song. This value is empty while playing a radio station.

Float TrackProgress: The progress of the current song (0 to 1). This value is empty while playing a radio station.

Float Volume: The currently set volume (0 to 1)

Bool IsRadioStation: Whether the music player is currently playing a radio station (true) or a playlist (false).
Sounds
For vehicle sounds, the use of Unreal Engine's MetaSounds is recommended. Sounds to be used must be imported in the Unreal Editor and should have a sampling rate of 44100 Hz. Any number of MetaSound assets can be created, which are controlled via Lua scripts.

To integrate a MetaSound asset into a vehicle, the reference to the object must first be copied. This is obtained by right-clicking on the MetaSound asset and selecting "Copy Reference". Then requireMetaSound can be called in the Lua script. This links the MetaSound asset with the respective Lua script and it can be controlled.

Script functions
RequireMetaSound(String Path)
This function links a MetaSound asset to the current script. Only one asset can be linked to a script at a time.

Path: Reference to the MetaSound asset.

RequireMetaSoundAtLocation(String Path, Float X, Float Y, Float Z)
This function links a MetaSound asset to the current script and places it at a specific position in the vehicle. Only one asset can be linked to a script at a time.

Path: Reference to the MetaSound asset.

X: X-Coordinate of the sound position

Y: Y-Coordinate of the sound position

Z: Z-Coordinate of the sound position

SetSoundInputFloat(String Name, Float Value)
Sets a float parameter in the linked MetaSound asset.

Name: Name of the parameter

Value: value to which the parameter should be set

SetSoundInputInt(String Name, Int Value)
Sets an integer parameter in the linked MetaSound asset.

Name: Name of the parameter

Value: Value to which the parameter should be set

SetSoundInputBool(String Name, Bool Value)
Sets a Boolean parameter in the linked MetaSound asset.

Name: Name of the parameter

Value: Value to which the parameter should be set

CallSoundTrigger(String Name)
Calls a trigger in the linked MetaSound asset.

Name: Name of the trigger
Displays - pt.1
Attachment parameters
To create a display, there is the attachment parameter "dynamicDisplays". This is an array which contains display definitions. A display definition has the following parameters:

Parameter
Data Type
Description
name
String
Name of the display
offset
Vector
Position offset from the attachment
rotationOffset
Rotator
Rotation offset from the attachment
scale
Vector
Size of the display (the actual size is the resolution multiplied by this parameter)
resolution
Vector2D
Resolution of the display in pixels
containsNavigation
Boolean
Determines whether this display can show a minimap with navigation.
navigationResolution
Vector2D
Resolution of the minimap (if available) in pixels
supportsInteraction
Boolean
Determines whether interactions are allowed for this display.

Textures and brushes
To draw textures on displays, the textures must first be imported in the Unreal Editor. Then a brush must be created for each texture and the respective texture must be assigned as an "image" in the brush.


To draw monochrome areas, it is also possible to omit the image in the brush and set the desired colour as "tint".

Fonts
In order to use certain fonts, they must first be imported into the Unreal Editor. Unreal creates a FontFace-Asset as well as a Font-Asset for each font. The font asset must be registered later in the script. To do this, a reference to the asset is required, which can be obtained by right-clicking on the asset and selecting "Copy Reference".

Scripting
The actual drawing of the display is done in the script. First, the correct context must be selected using activateDynamicDisplayContext. Then all brushes and fonts to be used have to be registered with registerBrush and registerFont. Afterwards, appropriate display elements can be created with createRectangle and createText. These elements can then be dynamically updated later to react to changing vehicle conditions.

Script functions
ActivateDynamicDisplayContext(String DynamicDisplayName)
This function sets the context to the specified display. All other functions always act on the active display, which is why this function must always be called first.

DynamicDisplayName: Name of the display to which the context is to be set.

ClearDynamicDisplay()
This function removes all existing elements from the active display.

registerBrush(String Path)
This function registers a brush for the active display. Please note that a registration is only valid for the active display and a brush that is to be used on several displays must also be registered for all displays. This function returns a BrushHandle, which can be used in other functions to reference this brush.

Path: Reference path to the brush asset.

registerFont(String Path)
This function registers a font for the active display. Please note that a registration is only valid for the active display and a font that is to be used on several displays must also be registered for all displays. As a return value, this function returns a FontHandle, which can be specified in other functions to reference this font.

Path: Reference path to the font asset.

CreateRectangle(Float PositionX, Float PositionY, Float SizeX, Float SizeY, Int BrushHandle)
Creates a rectangle at the specified position with the specified size using the specified brush. As a return value, this function returns a RectangleHandle, which can be used in other functions to reference this rectangle.

PositionX: X-coordinate of the position in pixels where the rectangle is to be drawn.

PositionY: Y-coordinate of the position in pixels where the rectangle is to be drawn.

SizeX: Width of the rectangle in pixels.

SizeY: Height of the rectangle in pixels.

BrushHandle: Handle of the brush to be used.

CreateText(String Text, Float PositionX, Float PositionY, Float SizeX, Float SizeY, Int FontHandle, Int FontSize, Float ColorR, Float ColorG, Float ColorB)
Creates a text with the given parameters. As a return value, this function returns a TextHandle, which can be specified in other functions to reference this text.

Text: Text

PositionX: X-coordinate of the position in pixels where the text is to be drawn.

PositionY: Y-coordinate of the position in pixels where the text is to be drawn.

SizeX: Width of the text in pixels.

SizeY: Height of the text in pixels.

FontHandle: Handle of the font to be used.

FontSize: Font size

ColorR: R-component of the font colour to be used

ColorG: G-component of the font colour to be used

ColorB: B-component of the font colour to be used

CreateNavigation(Float PositionX, Float PositionY, Float SizeX, Float SizeY)
Creates a rectangle containing a minimap with the current navigation. Only works if the DynamicDisplay parameter containsNavigation is set to true in the attachment. As a return value, this function returns a RectangleHandle, which can be used in other functions to reference this rectangle.

PositionX: X-coordinate of the position in pixels where the rectangle is to be drawn.

PositionY: Y-coordinate of the position in pixels where the rectangle is to be drawn.

SizeX: Width of the rectangle in pixels.

SizeY: Height of the rectangle in pixels.

SetNavigationZoom(Number Zoom)
With this function, the zoom level of the minimap can be set.

Zoom: New zoom value

SetNavigationLineThickness(Number LineThickness)
With this function, the line thickness of the navigation on the minimap can be set.

LineThickness: New line thickness

SetNavigationIconSize(Number Size)
With this function, the size of the PointOfInterest markers on the minimap can be set.

Size: New size

Continued in the next section.
Displays - pt.2
Continued from the previous section.

SetText(Int TextHandle, String NewText)
With this function, the text of an existing TextHandle can be updated.

TextHandle: TextHandle whose text is to be changed.

NewText: New text

SetTextFontSize(Int TextHandle, Int NewFontSize)
With this function, the font size of an existing TextHandle can be updated.

TextHandle: TextHandle whose font size is to be changed.

NewFontSize: New font size

SetTextColor(Int TextHandle, Float NewColorR, Float NewColorG, Float NewColorB, Float NewColorA)
This function can be used to update the text colour of an existing TextHandle.

TextHandle: TextHandle whose font size is to be changed.

NewColorR: R-component of the new text colour.

NewColorG: G-component of the new text colour.

NewColorB: B-component of the new text colour.

NewColorA: A-component of the new text colour.

SetTextFont(Int TextHandle, Int NewFontHandle)
This function can be used to update the font of an existing TextHandle.

TextHandle: TextHandle whose font is to be changed.

NewFontHandle: FontHandle of the new font.

SetTextAlignInCenter(Int TextHandle, Bool AlignInCenter)
This function can be used to centre text.

TextHandle: TextHandle whose text is to be centred.

AlignInCenter: True to centre the text, false to no longer centre it.

SetTextAlignRight(Int TextHandle, Bool AlignRight)
With this function, text can be set right-aligned.

TextHandle: TextHandle whose text is to be right-aligned.

AlignRight: True to set the text right-aligned, false to set it left-aligned

SetRectangleSize(Int RectangleHandle, Float SizeX, Float SizeY)
With this function, the size of an existing rectangle can be changed.

RectangleHandle: RectangleHandle of the rectangle to be resized.

SizeX: New width in pixels

SizeY: New height in pixels

SetRectanglePosition(Int RectangleHandle, Float PosX, Float PosY)
This function can be used to change the position of an existing rectangle.

RectangleHandle: RectangleHandle of the rectangle that is to be changed.

PosX: New X-coordinate in pixels

PosY: New Y-coordinate in pixels

SetRectangleRotation(Int RectangleHandle, Number Angle, Float RotateAroundPointX, Float RotateAroundPointY)
This function can be used to rotate an existing rectangle.

RectangleHandle: RectangleHandle of the rectangle that is to be changed.

Angle: New rotation angle

RotateAroundPointX: X-coordinate of the point around which the rectangle is to be rotated.

RotateAroundPointY: Y-coordinate of the point around which the rectangle is to be rotated.

HideElement(Int Handle)
This function hides an element.

Handle: Element handle.

ShowElement(Int Handle)
This function shows an element.

Handle: Element handle

SetRectangleBrush(Int RectangleHandle, Int BrushHandle)
With this function, the brush used for a rectangle can be changed.

RectangleHandle: RectangleHandle to the rectangle whose brush is to be changed

BrushHandle: BrushHandle for the brush to be used.

SetDisplayRendering(Bool Active)
This function determines whether the active display should be rendered.

Active: Should the display be rendered?
Cross-Menu
In order for a vehicle to function correctly with the cross menu, some adjustments are required.

Configuration in the data.json
In the vehicle's "data.json" it must be defined which functions the vehicle should provide in the cross menu. For this purpose, any number of cross menu functions can be created under "CrossMenuFunctions", which have the following parameters:

Parameter
Data Type
Description
name
String
Name of the function
category
String
Category
Icon
Reference Path
Reference to the icon texture for this function
States
String-Array
Array of all states this function can have
DefaultState
Integer
Index of the default state when the vehicle is initialised.

Example
"CrossMenuFunctions": [ { "Name": "Lightswitch", "Category": "Lights", "Icon": "Texture2D'/Game/Vehicles/Cars/Mercedes_AMG_C63_2016/Blueprints/Dashboard/Textures/ArrowUp.ArrowUp'", "States": [ "ParkingLight", "Automatic", "Headlight" ], "DefaultState": 1 }, { "Name": "Foglight", "Category": "Lights", "Icon": "Texture2D'/Game/Vehicles/Cars/Mercedes_AMG_C63_2016/Blueprints/Dashboard/Textures/ArrowUp.ArrowUp'", "States": [ "Off", "On" ], "DefaultState": 0 } ],

Scripting functions
Function called by the cross menu
onCrossMenuChanged(String Function, String State)
This function can be created in the script and is called by the control pad whenever the player clicks on a function in the control pad. The vehicle script should then ensure that the function selected by the player is actually executed (e.g. the light switch is turned to the corresponding position and the light is switched on).

Function: Name of the called function (e.g. "lightswitch"). Corresponds to "name" in "CrossMenuFunctions" in the "data.json".

State: New state to which the function is to be set (e.g. "lowbeam"). Corresponds to the corresponding entry in "states" in "CrossMenuFunctions" in the "data.json".

Function to be called by the script
updateCrossMenu(String Function, String State)
This function informs the cross menu that the state of a vehicle function has changed. This function should always be called by the script when the state of a function in the direction pad has changed, regardless of whether the change was triggered by onCrossMenuChanged or in some other way.

Function: Name of the function. Must correspond to a function name specified in "CrossMenuFunctions" in the "data.json".

State: New state. Must correspond to a function state specified in "CrossMenuFunctions" in "data.json".
Interactions
Interaction is when the player targets a vehicle attachment and then presses an interaction button. There are primary and secondary interactions and a distinction is made between pressing and releasing.

There are two different types of interaction. This distinction is necessary because a long press of the interaction button normally causes the player to enter or exit the vehicle. In this case, it is not possible to distinguish between the beginning and the end of the interaction because it is only when the button is released that it is determined whether the interaction is triggered at all. Therefore, as a second type, there are so-called "long" interactions that suppress the entry/exit and are triggered both at the beginning and at the end of the keystroke. This makes it possible, for example, to implement long keystrokes in the cockpit.

Attachment parameters
Interactions are configured for one attachment at a time. For this purpose, there is the attachment parameter "interaction", which has the following parameters:

Parameter
Data Type
Description
identifier
String
Name to identify the interaction
interactable
Boolean
Must be set to true for the interaction to be active.
allowLongInteraction
Boolean
Determines whether the exit interaction is suppressed, thus allowing long interactions (see above)
SupportSecondaryInteraction
Boolean
Determines whether this attachment allows a secondary interaction in addition to the primary interaction.
InfoText
String
Infotext for the interaction. Displayed when the attachment is targeted.
SecondaryInfoText
String
Infotext for the secondary interaction.
ExteriorOnly
Boolean
Determines whether this interaction only works from outside the vehicle.

Script function
onAttachmentInteract(String InteractionName, bool Secondary, bool Pressed)
This function in the script is always called when an attachment is interacted with.

InteractionName: Name of the interaction, corresponds to the parameter "identifier". If "identifier" is not defined, the role of the attachment is used instead.

Secondary: Is true if it is the secondary interaction.

Pressed: Is true if the interaction key was pressed and false if the interaction key was released. If the attachment does not support long interactions, this variable is always false.

Display interactions
It is also possible to set up display interactions. These are triggered whenever the player clicks on a display. For display interactions to work, the corresponding DynamicDisplay must have the supportsInteraction parameter set to true.

Script function
onDynamicDisplayInteract(String DisplayName, String AttachmentName, Bool Pressed, Float CoordinateX, Float CoordinateY)
This function in the script is always called when a display is interacted with.

DisplayName: Name of the display being interacted with.

AttachmentName: Name of the attachment to which the display is assigned. This distinction is important if there are displays in several attachments that have the same name.

Pressed: Is true if the interaction key was pressed and false if the interaction key was released.

CoordinateX: X-coordinate of the position in pixels where the display was clicked.

CoordinateY: Y-coordinate of the position in pixels where the display was clicked.
Upload and share

By now you've probably tested your mod frequently in CityDriver to make sure everything works as intended. In case you want to share your mod with the community, you can upload your mod in the "Vehicle Selection" in CityDriver to the Steam Workshop - your mod will be hidden by default, so you can test your mod with your friends before you publish it to the entire community.

You can find the option "Workshop Settings" in the bottom right corner of the UI, shortcut R.

Submitting your mod will take a while as the files are being uploaded to Steam Workshop in the background.

Where can you find your mod in the Steam Workshop?
When your mod files have been successfully submitted to the Workshop you can find your mod in your Steam Profile under "Workshop Submission".

You can also update and publish your mod later via the "Workshop Settings" in the "Vehicle Selection" of CityDriver too.

Make sure to check your mod on the Steam Workshop before you publish it, as you may have to check Steam's Workshop Agreement occasionally. Also, uploading a preview image for your mod can currently only be done via the Steam Workshop itself and CityDriver provides a convenient Photo mode for screenshots.

Reuploading a mod via CityDriver after deleting the Mod in the Steam Workshop
In case you've deleted your mod on the Steam Workshop and want to upload it via CityDriver again for whatever reason, you will have to delete the number of the workshopId in the default.json of your mod files, e.g.

Before:
"workshopId": "2976988849"
After:
"workshopId": ""



End of line
And that's about it for this version of CityDriver's vehicle modding. Feel free to write your comments down below or join us on our Discord: https://discord.gg/viewapp-community

1 Comments
nielshd2 7 Jun, 2023 @ 9:11am 
Vehicle Modding is incorrect I can't see the picture at Using own assets using Unreal Engine I am using Unreal Engine 5.1.1