Arma 3 Scripting

Command in Unit Control, Object Manipulation

setCruiseControl

Also available as Markdown and JSON, or read the original wiki page.

Description

Limits or sets local player-controlled vehicle's speed through cruise control.

Note

  • this command only works on CarX, TankX, ShipX simulation vehicles
  • this command is implemented using a PID controller overwriting the vehicle's thrust/brakes input
Speed Limiter Cruise Control
- the vehicle does not accelerate by itself
- manually accelerating is required to move forward
- accelerating beyond set speed limit is restricted by the PID controller
- applying brakes does not disable Speed Limiter
- behaviour:
- if the speed is over 120% the set limit, the vehicle will apply 100% of braking and limit acceleration to 0%
- if the speed is below 80% the set limit, the acceleration and braking are untouched
- between 80 and 120%, the PID controller limits the acceleration and applies brakes if required
- the vehicle accelerates by itself
- manually accelerating is possible
- accelerating above set speed limit is possible
- applying brakes disables Cruise Control
- behaviour:
- if the speed is over 120% the set limit, the vehicle will apply 100% of braking
- if the speed is below 80% the set limit, the vehicle will apply 100% of acceleration
- between 80 and 120%, the PID controller manages the speed

Important

This command should only be called to change values and not be called every frame, as it resets the PID controller.

Syntax

vehicle setCruiseControl [speed, autoThrust]

Parameters:

Returns: Nothing

Examples

Example 1

vehicle player setCruiseControl [50, true]; // sets cruise control to 50 km/h

Example 2

vehicle player setCruiseControl [5, false]; // limits player's vehicle speed to 5 km/h

See also

getCruiseControl · limitSpeed · forceSpeed · setAirplaneThrottle