Base Vehicle
Base class for all Vehicle entities
Classes that share methods and events from this Base Class: VehicleWheeled, VehicleWater.
๐ฆ Functionsโ
| Animation | ||
BindAnimationBlueprintEventDispatcher: function | Assigns and Binds an Animation Blueprint Event Dispatcher | |
CallAnimationBlueprintEvent: varargs of any | Calls an Animation Blueprint Event or Function | |
GetAnimationBlueprintPropertyValue: any | Gets an Animation Blueprint Property/Variable value directly | |
PlayAnimation | Plays an Animation on this Vehicle | |
SetAnimationBlueprintPropertyValue | Sets an Animation Blueprint Property/Variable value directly | |
StopAnimation | Stops an Animation Montage on this Vehicle | |
UnbindAnimationBlueprintEventDispatcher | Unbinds an Animation Blueprint Event Dispatcher | |
| Appearance | ||
GetMesh: SkeletalMesh Reference | Gets the Asset name | |
HideBone | Hides a bone of this Vehicle | |
IsBoneHidden: boolean | Gets if a bone is hidden | |
UnHideBone | UnHide a bone of this Vehicle | |
| Attachments | ||
AddSkeletalMeshAttached | Attaches a Skeletal Mesh as master pose to this entity | |
AddStaticMeshAttached | Attaches a Static Mesh to this entity | |
GetAllSkeletalMeshAttached: table of string | Gets all Skeletal Meshes attached to this entity | |
GetAllStaticMeshAttached: table of string | Gets all Static Meshes attached to this entity | |
RemoveAllSkeletalMeshesAttached | Removes all SkeletalMeshes attached | |
RemoveAllStaticMeshesAttached | Removes all StaticMeshes attached | |
RemoveSkeletalMeshAttached | Removes, if it exists, a SkeletalMesh from this Vehicle given its custom ID | |
RemoveStaticMeshAttached | Removes, if it exists, a StaticMesh from this Vehicle given its custom ID | |
SetStaticMeshAttachedTransform | Sets a Static Mesh Attached location and rotation | |
| Handling | ||
IsEngineStarted: boolean | Checks if the engine is started | |
SetCameraArmLength | Sets how far the camera stays from this Vehicle while driving it | |
SetCameraOffset | Sets the Vehicle Camera Offset | |
| Passengers | ||
GetDoors: table | Gets all configured Doors | |
GetPassenger: Character | Gets a passenger from a seat | |
GetPassengers: table of Character | Gets all passengers | |
SetDoor | Adds a Door to the Vehicle | |
| Physics | ||
SetBuoyancyPontoons | Sets the Buoyancy Pontoons used by the Water simulation | |
SetBuoyancySettings | Sets how this entity behaves on Water | |
SetExplosionSettings | Configures the Explosion Settings when health reaches zero | |
Animationfunctionsโ

BindAnimationBlueprintEventDispatcherSlowโ
Assigns and Binds an Animation Blueprint Event Dispatcher
Note: only VehicleWheeled has an Animation Blueprint, on any other Vehicle type this does nothing
local ret = my_vehicle:BindAnimationBlueprintEventDispatcher(dispatcher_name, callback)
Parameters
| Name | Type | Description |
|---|---|---|
dispatcher_name | string | Event Dispatcher name |
callback | function | Callback function to call with this format |
Returns
| Type | Description |
|---|---|
| function | the callback itself |

CallAnimationBlueprintEventSlowโ
Calls an Animation Blueprint Event or Function
Returns all Function return values on Client Side
Note: only VehicleWheeled has an Animation Blueprint, on any other Vehicle type this does nothing
local ret_01, ret_02, ... = my_vehicle:CallAnimationBlueprintEvent(event_name, arguments...?)

GetAnimationBlueprintPropertyValueSlowโ
Gets an Animation Blueprint Property/Variable value directly
Note: only VehicleWheeled has an Animation Blueprint, on any other Vehicle type this returns nil
local ret = my_vehicle:GetAnimationBlueprintPropertyValue(property_name)
Parameters
| Name | Type | Description |
|---|---|---|
property_name | string | Name of the Animation Blueprint variable |
Returns
| Type | Description |
|---|---|
| any | the property value |
See also SetAnimationBlueprintPropertyValue.

PlayAnimationModerateโ
Plays an Animation on this Vehicle
my_vehicle:PlayAnimation(animation_path, slot_name?, loop_indefinitely?, blend_in_time?, blend_out_time?, play_rate?, stop_all_montages?)
Parameters
| Name | Type | Description |
|---|---|---|
animation_path | Animation Reference | The Animation asset to play |
slot_name? | string | The Animation Slot to play it on Default DefaultSlot |
loop_indefinitely? | boolean | This parameter is only used if the Vehicle has an Animation Blueprint Default false |
blend_in_time? | float | This parameter is only used if the Vehicle has an Animation Blueprint Default 0.25 |
blend_out_time? | float | This parameter is only used if the Vehicle has an Animation Blueprint Default 0.25 |
play_rate? | float | This parameter is only used if the Vehicle has an Animation Blueprint Default 1.0 |
stop_all_montages? | boolean | Stops all running Montages from the same Group. This parameter is only used if the Vehicle has an Animation Blueprint Default false |

SetAnimationBlueprintPropertyValueSlowโ
Sets an Animation Blueprint Property/Variable value directly
It is set on the Animation Blueprint passed in the constructor.
Note: only VehicleWheeled has an Animation Blueprint, on any other Vehicle type this does nothing
my_vehicle:SetAnimationBlueprintPropertyValue(property_name, value)
Parameters
| Name | Type | Description |
|---|---|---|
property_name | string | Name of the Animation Blueprint variable |
value | any | The value to set |
See also GetAnimationBlueprintPropertyValue.

StopAnimationOptimalโ
Stops an Animation Montage on this Vehicle
my_vehicle:StopAnimation(animation_asset?)
Parameters
| Name | Type | Description |
|---|---|---|
animation_asset? | Animation Reference | Leave empty to stop all Montages Default |

UnbindAnimationBlueprintEventDispatcherOptimalโ
Unbinds an Animation Blueprint Event Dispatcher
my_vehicle:UnbindAnimationBlueprintEventDispatcher(dispatcher_name, callback?)
Appearancefunctionsโ

GetMeshOptimalโ
Gets the Asset name
local asset = my_vehicle:GetMesh()
Returns
| Type | Description |
|---|---|
| SkeletalMesh Reference | asset path |

HideBoneOptimalโ
Hides a bone of this Vehicle
my_vehicle:HideBone(bone_name)
Parameters
| Name | Type | Description |
|---|---|---|
bone_name | string | Bone to hide |
See also UnHideBone, IsBoneHidden.

IsBoneHiddenOptimalโ
Gets if a bone is hidden
local is_hidden = my_vehicle:IsBoneHidden(bone_name)
Parameters
| Name | Type | Description |
|---|---|---|
bone_name | string | Bone to check |
Returns
| Type | Description |
|---|---|
| boolean | if the bone is hidden |
See also UnHideBone, HideBone.

UnHideBoneOptimalโ
UnHide a bone of this Vehicle
my_vehicle:UnHideBone(bone_name)
Parameters
| Name | Type | Description |
|---|---|---|
bone_name | string | Bone to unhide |
See also HideBone, IsBoneHidden.
Attachmentsfunctionsโ

AddSkeletalMeshAttachedSlowโ
Attaches a Skeletal Mesh as master pose to this entity
Spawns and attaches a SkeletalMesh to this entity, the SkeletalMesh must have the same skeleton used by this Actor's mesh, and will follow all animations from it. Uses a custom ID to be used for removing/customizing it afterwards
my_vehicle:AddSkeletalMeshAttached(id, skeletal_mesh_path, socket?, relative_location?, relative_rotation?, use_parent_bounds?, use_base_leader_pose_component?, animation_path?, attachable_id?)
Parameters
| Name | Type | Description |
|---|---|---|
id | string | Used further for removing or applying material settings on it |
skeletal_mesh_path | SkeletalMesh Reference | Path to SkeletalMesh asset to attach |
socket? | string | Bone socket to attach to Default |
relative_location? | Vector | Relative location Default Vector(0, 0, 0) |
relative_rotation? | Rotator | Relative rotation Default Rotator(0, 0, 0) |
use_parent_bounds? | boolean | If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together Default true |
use_base_leader_pose_component? | boolean | If true, this component will use the base leader pose component for copying its animation Default true |
animation_path? | Animation Reference | Path to Animation asset to play on the Skeletal Mesh attached Default |
attachable_id? | string | Optionally attaches this to another attached skeletal mesh (instead of attaching to the root component) Default |
See also RemoveSkeletalMeshAttached.

AddStaticMeshAttachedSlowโ
Attaches a Static Mesh to this entity
Spawns and attaches a StaticMesh to this Vehicle in a Socket with a relative location and rotation. Uses a custom ID to be used for removing/customizing it afterwards
my_vehicle:AddStaticMeshAttached(id, static_mesh_path, socket?, relative_location?, relative_rotation?, use_parent_bounds?, attachable_id?)
Parameters
| Name | Type | Description |
|---|---|---|
id | string | Unique ID to assign to the StaticMesh |
static_mesh_path | StaticMesh Reference | Path to StaticMesh asset to attach |
socket? | string | Bone socket to attach to Default |
relative_location? | Vector | Relative location Default Vector(0, 0, 0) |
relative_rotation? | Rotator | Relative rotation Default Rotator(0, 0, 0) |
use_parent_bounds? | boolean | If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together Default true |
attachable_id? | string | Optionally attaches this to another attached static mesh (instead of attaching to the root component) Default |
See also SetStaticMeshAttachedTransform, RemoveStaticMeshAttached.

GetAllSkeletalMeshAttachedOptimalโ
Gets all Skeletal Meshes attached to this entity
local ret = my_vehicle:GetAllSkeletalMeshAttached()

GetAllStaticMeshAttachedOptimalโ
Gets all Static Meshes attached to this entity
local ret = my_vehicle:GetAllStaticMeshAttached()

RemoveAllSkeletalMeshesAttachedOptimalโ
Removes all SkeletalMeshes attached
my_vehicle:RemoveAllSkeletalMeshesAttached()

RemoveAllStaticMeshesAttachedOptimalโ
Removes all StaticMeshes attached
my_vehicle:RemoveAllStaticMeshesAttached()

RemoveSkeletalMeshAttachedOptimalโ
Removes, if it exists, a SkeletalMesh from this Vehicle given its custom ID
my_vehicle:RemoveSkeletalMeshAttached(id)
Parameters
| Name | Type | Description |
|---|---|---|
id | string | Unique ID of the SkeletalMesh to remove |
See also AddSkeletalMeshAttached.

RemoveStaticMeshAttachedOptimalโ
Removes, if it exists, a StaticMesh from this Vehicle given its custom ID
my_vehicle:RemoveStaticMeshAttached(id)
Parameters
| Name | Type | Description |
|---|---|---|
id | string | Unique ID of the StaticMesh to remove |
See also AddStaticMeshAttached.

SetStaticMeshAttachedTransformOptimalโ
Sets a Static Mesh Attached location and rotation
my_vehicle:SetStaticMeshAttachedTransform(id, relative_location, relative_rotation)
Parameters
| Name | Type | Description |
|---|---|---|
id | string | Unique ID of the StaticMesh set with AddStaticMeshAttached |
relative_location | Vector | New relative location |
relative_rotation | Rotator | New relative rotation |
See also AddStaticMeshAttached.
Handlingfunctionsโ

IsEngineStartedOptimalโ
Checks if the engine is started
local is_started = my_vehicle:IsEngineStarted()
Returns
| Type | Description |
|---|---|
| boolean | Whether the engine is started |

SetCameraArmLengthOptimalโ
Sets how far the camera stays from this Vehicle while driving it
The length is in centimeters. This overrides the Player's own Camera Arm Length for as long as they are driving it. Set it to 0 to use the Player's value instead, which is the default
my_vehicle:SetCameraArmLength(arm_length)
Parameters
| Name | Type | Description |
|---|---|---|
arm_length | integer | The distance in centimeters, or 0 to use the Player's own value |

SetCameraOffsetOptimalโ
Sets the Vehicle Camera Offset
my_vehicle:SetCameraOffset(offset)
Parameters
| Name | Type | Description |
|---|---|---|
offset | Vector | The new Vehicle Camera Offset |
Passengersfunctionsโ

GetDoorsModerateโ
Gets all configured Doors
local ret = my_vehicle:GetDoors()
Returns
| Type | Description |
|---|---|
| table | All configured Doors |

GetPassengerOptimalโ
Gets a passenger from a seat
local passenger = my_vehicle:GetPassenger(seat)
Parameters
| Name | Type | Description |
|---|---|---|
seat | integer | Index of the seat, 0 is the driver |
Returns
| Type | Description |
|---|---|
| Character | or nil if no passenger in seat |

SetDoorOptimalโ
Adds a Door to the Vehicle
Adds a Door at offset_location from root which will pose the Character at seat_location with seat_rotation rotation
my_vehicle:SetDoor(seat_index, offset_location, seat_location, seat_rotation, trigger_radius, leave_lateral_offset)
Parameters
| Name | Type | Description |
|---|---|---|
seat_index | integer | Index of the seat, 0 is the driver |
offset_location | Vector | Location of the door trigger relative to the vehicle |
seat_location | Vector | Location of the seat relative to the vehicle |
seat_rotation | Rotator | Rotation of the seat relative to the vehicle |
trigger_radius | integer | Radius of the trigger used to enter through this door |
leave_lateral_offset | integer | It's where the Character will be ejected when leaving it (e.g. -150 for left door or 150 for right door) |
Physicsfunctionsโ

SetBuoyancyPontoonsModerateโ
Sets the Buoyancy Pontoons used by the Water simulation
Sets the spherical Pontoons used to float this entity on Water, overriding the ones automatically calculated from the Mesh bounds and mass.
Pass no value (or an empty table) to go back to the automatically calculated ones.
Pontoons only have an effect on Maps with Water Buoyancy enabled
my_vehicle:SetBuoyancyPontoons(pontoons?)

SetBuoyancySettingsModerateโ
Sets how this entity behaves on Water
Any value passed as nil restores that setting's default.
The automatically calculated Pontoons are sized for the default buoyancy_coefficient, so a higher one makes the entity float higher
my_vehicle:SetBuoyancySettings(enabled?, buoyancy_coefficient?, buoyancy_damp?, max_buoyant_force?)
Parameters
| Name | Type | Description |
|---|---|---|
enabled? | boolean | Whether Buoyancy forces are applied at all Default true |
buoyancy_coefficient? | float | How much it floats, the higher the more Default 0.1 |
buoyancy_damp? | float | First order damping on the vertical velocity, reduces bobbing. When nil (or negative) it is calculated from the mass and Pontoons Default nil |
max_buoyant_force? | float | Clamp on the upwards force, stops light objects being launched out of the water Default 1000000000 |

SetExplosionSettingsOptimalโ
Configures the Explosion Settings when health reaches zero
my_vehicle:SetExplosionSettings(engine_relative_location, materials_index_burnt_override, materials_index_burnt_invisible)
Parameters
| Name | Type | Description |
|---|---|---|
engine_relative_location | Vector | Relative location of the Engine. Used to apply particles and effects |
materials_index_burnt_override | table | List of material indexes to override to burnt when exploded. Leave it empty for all indexes |
materials_index_burnt_invisible | table | List of material indexes to override to invisible when exploded. Leave it empty for all indexes |
Examples (1)
my_vehicle:SetExplosionSettings(Vector(-50, 0, 0), { 1, 2, 4 }, { 3 })
๐ Eventsโ
CharacterAttemptEnter | Triggered when a Character attempts to enter the Vehicle | |
CharacterAttemptLeave | Triggered when a Character attempts to leave the Vehicle | |
CharacterEnter | Triggered when a Character fully enters the Vehicle | |
CharacterLeave | Triggered when a Character fully leaves the Vehicle | |
EngineStart | Triggered when the engine starts | |
EngineStop | Triggered when the engine stops | |
Hit | Triggered when Vehicle hits something |

CharacterAttemptEnterโ
Triggered when a Character attempts to enter the Vehicle
<AnyVehicleClass>.Subscribe("CharacterAttemptEnter", function(self, character, seat)
-- CharacterAttemptEnter was called
return true
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |
character | Character | The Character |
seat | integer | The seat index |
Returns
| Type | Description |
|---|---|
| boolean | Return false to prevent it |

CharacterAttemptLeaveโ
Triggered when a Character attempts to leave the Vehicle
<AnyVehicleClass>.Subscribe("CharacterAttemptLeave", function(self, character)
-- CharacterAttemptLeave was called
return true
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |
character | Character | The Character |
Returns
| Type | Description |
|---|---|
| boolean | Return false to prevent it |

CharacterEnterโ
Triggered when a Character fully enters the Vehicle
<AnyVehicleClass>.Subscribe("CharacterEnter", function(self, character, seat_index)
-- CharacterEnter was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |
character | Character | The Character |
seat_index | integer | The seat entered, 0 is the driver |

CharacterLeaveโ
Triggered when a Character fully leaves the Vehicle
<AnyVehicleClass>.Subscribe("CharacterLeave", function(self, character, seat_index)
-- CharacterLeave was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |
character | Character | The Character |
seat_index | integer | The seat left, 0 is the driver |

EngineStartโ
Triggered when the engine starts
<AnyVehicleClass>.Subscribe("EngineStart", function(self)
-- EngineStart was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |

EngineStopโ
Triggered when the engine stops
<AnyVehicleClass>.Subscribe("EngineStop", function(self)
-- EngineStop was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |

Hitโ
Triggered when Vehicle hits something
<AnyVehicleClass>.Subscribe("Hit", function(self, impact_force, normal_impulse, impact_location, velocity, other_actor)
-- Hit was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Base Vehicle | The Vehicle that triggered the event |
impact_force | float | The intensity of the Hit normalized by the Vehicle's weight |
normal_impulse | Vector | The impulse direction it hits |
impact_location | Vector | The world 3D location of the impact |
velocity | Vector | The Vehicle velocity at the moment it hits |
other_actor | Base Actor or nil | The other actor that hit this Vehicle |


