Base Vehicle
Base class for all Vehicle entities.
Base ClassAPI Source
๐ชBase Class
This is a Base Class, an abstract definition that shares common methods and events with it's child classes. You cannot spawn it, and you cannot call anything on the Base Class name itself. Use any class that inherits it.
Classes that share methods and events from this Base Class: VehicleWheeled, VehicleWater.
Classes that share methods and events from this Base Class: VehicleWheeled, VehicleWater.
๐ฆ ย Functionsโ
| Returns | Name | Description | |
|---|---|---|---|
AddSkeletalMeshAttached | Attaches a Skeletal Mesh as master pose to this entity | ||
AddStaticMeshAttached | Attaches a Static Mesh to this entity | ||
| function | BindAnimationBlueprintEventDispatcher | Assigns and Binds an Animation Blueprint Event Dispatcher | |
| varargs of any | CallAnimationBlueprintEvent | Calls an Animation Blueprint Event or Function | |
| table of string | GetAllSkeletalMeshAttached | Gets all Skeletal Meshes attached to this entity | |
| table of string | GetAllStaticMeshAttached | Gets all Static Meshes attached to this entity | |
| any | GetAnimationBlueprintPropertyValue | Gets an Animation Blueprint Property/Variable value directly | |
| table | GetDoors | Gets all configured Doors | |
| SkeletalMesh Reference | GetMesh | Gets the Asset name | |
| Character | GetPassenger | Gets a passenger from a seat | |
| table of Character | GetPassengers | Gets all passengers | |
| boolean | IsEngineStarted | Checks if the engine is started | |
PlayAnimation | Plays an Animation on this Vehicle | ||
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 | ||
SetAnimationBlueprintPropertyValue | Sets an Animation Blueprint Property/Variable value directly | ||
SetBuoyancyPontoons | Sets the Buoyancy Pontoons used by the Water simulation | ||
SetBuoyancySettings | Sets how this entity behaves on Water | ||
SetCameraArmLength | Sets how far the camera stays from this Vehicle while driving it | ||
SetCameraOffset | Sets the Vehicle Camera Offset | ||
SetDoor | Adds a Door to the Vehicle | ||
SetExplosionSettings | Configures the Explosion Settings when health reaches zero | ||
SetStaticMeshAttachedTransform | Sets a Static Mesh Attached location and rotation | ||
StopAnimation | Stops an Animation Montage on this Vehicle | ||
UnbindAnimationBlueprintEventDispatcher | Unbinds an Animation Blueprint Event Dispatcher |
Slow

AddSkeletalMeshAttachedโ
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
๐Updated Function
This method was recently updated in ver. 1.144. See the Compatibility Versions page for more information.
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
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | id | Required parameter | Used further for removing or applying material settings on it |
| SkeletalMesh Reference | skeletal_mesh_path | Required parameter | Path to SkeletalMesh asset to attach |
| string | socket? | | Bone socket to attach to |
| Vector | relative_location? | Vector(0, 0, 0) | Relative location |
| Rotator | relative_rotation? | Rotator(0, 0, 0) | Relative rotation |
| boolean | use_parent_bounds? | true | If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together |
| boolean | use_base_leader_pose_component? | true | If true, this component will use the base leader pose component for copying its animation |
| Animation Reference | animation_path? | | Path to Animation asset to play on the Skeletal Mesh attached |
| string | attachable_id? | | Optionally attaches this to another attached skeletal mesh (instead of attaching to the root component) |
See also RemoveSkeletalMeshAttached.
Slow

AddStaticMeshAttachedโ
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
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | id | Required parameter | Unique ID to assign to the StaticMesh |
| StaticMesh Reference | static_mesh_path | Required parameter | Path to StaticMesh asset to attach |
| string | socket? | | Bone socket to attach to |
| Vector | relative_location? | Vector(0, 0, 0) | Relative location |
| Rotator | relative_rotation? | Rotator(0, 0, 0) | Relative rotation |
| boolean | use_parent_bounds? | true | If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together |
| string | attachable_id? | | Optionally attaches this to another attached static mesh (instead of attaching to the root component) |
See also SetStaticMeshAttachedTransform, RemoveStaticMeshAttached.
Slow

BindAnimationBlueprintEventDispatcherโ
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
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | dispatcher_name | Required parameter | Event Dispatcher name |
| function | callback | Required parameter | Callback function to call with this format |
Returns
| Type | Description |
|---|---|
| function | the callback itself |
Slow

CallAnimationBlueprintEventโ
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...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Event or Function name |
| any | arguments...? | nil | Sequence of arguments to pass to the event |
Optimal

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

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

GetAnimationBlueprintPropertyValueโ
Gets an Animation Blueprint Property/Variable value directly.
Note: only VehicleWheeled has an Animation Blueprint, on any other Vehicle type this returnsnil.
local ret = my_vehicle:GetAnimationBlueprintPropertyValue(property_name)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | property_name | Required parameter | No description provided |
Returns
| Type | Description |
|---|---|
| any | the property value |
See also SetAnimationBlueprintPropertyValue.
Moderate

GetDoorsโ
Gets all configured Doors
local ret = my_vehicle:GetDoors()
Returns
| Type | Description |
|---|---|
| table | with this format |
Optimal

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

GetPassengerโ
Gets a passenger from a seat
local passenger = my_vehicle:GetPassenger(seat)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | seat | Required parameter | No description provided |
Returns
| Type | Description |
|---|---|
| Character | or nil if no passenger in seat |
Moderate

GetPassengersโ
Gets all passengers
local passengers = my_vehicle:GetPassengers()
Optimal

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

PlayAnimationโ
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
| Type | Parameter | Default | Description |
|---|---|---|---|
| Animation Reference | animation_path | Required parameter | No description provided |
| string | slot_name? | DefaultSlot | No description provided |
| boolean | loop_indefinitely? | false | This parameter is only used if the Vehicle has an Animation Blueprint |
| float | blend_in_time? | 0.25 | This parameter is only used if the Vehicle has an Animation Blueprint |
| float | blend_out_time? | 0.25 | This parameter is only used if the Vehicle has an Animation Blueprint |
| float | play_rate? | 1.0 | This parameter is only used if the Vehicle has an Animation Blueprint |
| boolean | stop_all_montages? | false | Stops all running Montages from the same Group. This parameter is only used if the Vehicle has an Animation Blueprint |
Optimal

RemoveAllSkeletalMeshesAttachedโ
Removes all SkeletalMeshes attached
my_vehicle:RemoveAllSkeletalMeshesAttached()
Optimal

RemoveAllStaticMeshesAttachedโ
Removes all StaticMeshes attached
my_vehicle:RemoveAllStaticMeshesAttached()
Optimal

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

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

SetAnimationBlueprintPropertyValueโ
Sets an Animation Blueprint Property/Variable value directly 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
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | property_name | Required parameter | No description provided |
| any | value | Required parameter | No description provided |
See also GetAnimationBlueprintPropertyValue.
Moderate

SetBuoyancyPontoonsโ
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?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| table | pontoons? | nil | Array with the Pontoons, or nil to restore the automatically calculated ones with this format |
Moderate

SetBuoyancySettingsโ
Any value passed as nil restores that setting's default.
While the Pontoons are being automatically calculated, changing buoyancy_coefficient also recalculates them, as their radius derives from it.
my_vehicle:SetBuoyancySettings(enabled?, buoyancy_coefficient?, buoyancy_damp?, max_buoyant_force?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | enabled? | true | Whether Buoyancy forces are applied at all |
| float | buoyancy_coefficient? | 0.1 | How much it floats, the higher the more |
| float | buoyancy_damp? | 1000 | First order damping on the vertical velocity, reduces bobbing |
| float | max_buoyant_force? | 5000000 | Clamp on the upwards force, stops light objects being launched out of the water |
Optimal

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

SetCameraOffsetโ
Sets the Vehicle Camera Offset
my_vehicle:SetCameraOffset(offset)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | offset | Required parameter | No description provided |
Optimal

SetDoorโ
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
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | seat_index | Required parameter | No description provided |
| Vector | offset_location | Required parameter | No description provided |
| Vector | seat_location | Required parameter | No description provided |
| Rotator | seat_rotation | Required parameter | No description provided |
| integer | trigger_radius | Required parameter | No description provided |
| integer | leave_lateral_offset | Required parameter | It's where the Character will be ejected when leaving it (e.g. -150 for left door or 150 for right door) |
Optimal

SetExplosionSettingsโ
Configures the Explosion Settings when health reaches zero
my_vehicle:SetExplosionSettings(engine_relative_location, materials_index_burnt_override, materials_index_burnt_invisible)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | engine_relative_location | Required parameter | Relative location of the Engine. Used to apply particles and effects. |
| table | materials_index_burnt_override | Required parameter | List of material indexes to override to burnt when exploded. Leave it empty for all indexes. |
| table | materials_index_burnt_invisible | Required parameter | List of material indexes to override to invisible when exploded. Leave it empty for all indexes. |
Vehicle.SetExplosionSettings Examples
Vehicle Explosion Settings
my_vehicle:SetExplosionSettings(Vector(-50, 0, 0), { 1, 2, 4 }, { 3 })
Optimal

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

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

UnbindAnimationBlueprintEventDispatcherโ
Unbinds an Animation Blueprint Event Dispatcher
my_vehicle:UnbindAnimationBlueprintEventDispatcher(dispatcher_name, callback?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | dispatcher_name | Required parameter | Event Dispatcher name |
| function | callback? | nil | Optional callback to unbind |
๐ย Eventsโ
| Name | Description | |
|---|---|---|
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
Return false to prevent it
<AnyVehicleClass>.Subscribe("CharacterAttemptEnter", function(self, character, seat)
-- CharacterAttemptEnter was called
return true
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |
| Character | character | No description provided |
| integer | seat | The seat index |

CharacterAttemptLeaveโ
Triggered when a Character attempts to leave the Vehicle
Return false to prevent it
<AnyVehicleClass>.Subscribe("CharacterAttemptLeave", function(self, character)
-- CharacterAttemptLeave was called
return true
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |
| Character | character | No description provided |

CharacterEnterโ
Triggered when a Character fully enters the Vehicle
<AnyVehicleClass>.Subscribe("CharacterEnter", function(self, character, seat_index)
-- CharacterEnter was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |
| Character | character | No description provided |
| integer | seat_index | No description provided |

CharacterLeaveโ
Triggered when a Character fully leaves the Vehicle
<AnyVehicleClass>.Subscribe("CharacterLeave", function(self, character, seat_index)
-- CharacterLeave was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |
| Character | character | No description provided |
| integer | seat_index | No description provided |

EngineStartโ
Triggered when the engine starts
<AnyVehicleClass>.Subscribe("EngineStart", function(self)
-- EngineStart was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |

EngineStopโ
Triggered when the engine stops
<AnyVehicleClass>.Subscribe("EngineStop", function(self)
-- EngineStop was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |

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
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |
| integer | impact_force | The intensity of the Hit normalized by the Vehicle's weight |
| Vector | normal_impulse | The impulse direction it hits |
| Vector | impact_location | The world 3D location of the impact |
| Vector | velocity | The Vehicle velocity at the moment it hits |
| Base Actor or nil | other_actor | The other actor that hit this Vehicle |


