Skip to content

VehicleDriveLogic ​

Inherits: DriveLogic < Resource

The way a cart, a tank or a boat is steered: W and S speed up and brake or reverse, A and D turn. The vehicle keeps its speed when no key is pressed and slows down with its braking; it turns faster the faster it goes (it cannot spin on the spot).

Properties ​

floatacceleration6.0
floatbraking10.0
floatturn_rate_degrees90.0
floatreverse_speed_share0.4

Methods ​

Dictionaryget_field_descriptions()
Stringget_drive_type_name()
Stringget_drive_type_description()
voidbegin( p_session: MountSession )
voiddrive( input: Vector2, delta: float )
voidend()
floatget_speed()

Property descriptions ​

float acceleration = 6.0 ​

How fast it speeds up (units per second, each second)

float braking = 10.0 ​

How fast it slows down when the brake is pressed (units per second, each second). With no key it slows down at half of this

float turn_rate_degrees = 90.0 ​

How fast it turns at full speed (degrees per second)

float reverse_speed_share = 0.4 ​

How fast it can reverse, as a share of its top speed

Method descriptions ​

Dictionary get_field_descriptions() ​

The sentences the editor shows as tooltips: {name of an exported variable: text}. A logic of your own adds its variables (call super and merge) (from DriveLogic)

String get_drive_type_name() ​

What this logic is called in the editor list (from DriveLogic)

String get_drive_type_description() ​

A sentence about how this logic steers, for the editor (from DriveLogic)

void begin( p_session: MountSession ) ​

The rider got on. Override to set up a state (from DriveLogic)

void drive( input: Vector2, delta: float ) ​

Every physics frame while the rider is on. input is the move keys (x right, y forward, each -1 to 1), zero when the player does not steer this rider. Override this (from DriveLogic)

void end() ​

The rider got off. Override to clean up (from DriveLogic)

float get_speed() ​

The speed the vehicle has now (negative in reverse)