Skip to main content
Version: latest - a1.73.x βš–οΈ

Base Vehicle

Base class for all Vehicle entities.

πŸ§‘β€πŸ’»API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
πŸ‘ͺBase Class
This is a Base Class. Base Classes are abstract definitions used to share common methods and events between related child classes, thus you cannot spawn it directly.

Classes that share methods and events from this Base Class: VehicleWheeled, VehicleWater.

🦠 Functions​

ReturnsNameDescription
Attaches a Skeletal Mesh as master pose to this entity
Attaches a Static Mesh to this entity
of Gets all Skeletal Meshes attached to this entity
of Gets all Static Meshes attached to this entity
Gets all configured Doors
Gets the Asset name
CharacterGets a passenger from a seat
of CharacterGets all passengers
Plays an Animation on this Vehicle
Removes all SkeletalMeshes attached
Removes all StaticMeshes attached
Removes, if it exists, a SkeletalMesh from this Pickable given its custom ID
Removes, if it exists, a StaticMesh from this Pickable given its custom ID
Adds a Door to the Vehicle
Configures the Explosion Settings when health reaches zero
Sets a Static Mesh Attached location and rotation

AddSkeletalMeshAttached

Spawns and attaches a SkeletalMesh to this Pickable, 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, use_parent_bounds?)
TypeParameterDefaultDescription
id Required parameter Used further for removing or applying material settings on it
skeletal_mesh_path Required parameter Path to SkeletalMesh asset to attach
use_parent_bounds?trueIf true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together

See also RemoveSkeletalMeshAttached.


AddStaticMeshAttached

Spawns and attaches a StaticMesh to this Pickable 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?)
TypeParameterDefaultDescription
id Required parameter Unique ID to assign to the StaticMesh
static_mesh_path Required parameter Path to StaticMesh asset to attach
socket?Bone socket to attach to
Vectorrelative_location?Vector(0, 0, 0)Relative location
Rotatorrelative_rotation?Rotator(0, 0, 0)Relative rotation
use_parent_bounds?trueIf true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together

See also SetStaticMeshAttachedTransform, RemoveStaticMeshAttached.


GetAllSkeletalMeshAttached

Gets all Skeletal Meshes attached to this entity

β€” Returns of (the key as the Attached ID, and the value as the Asset Path).

local ret = my_vehicle:GetAllSkeletalMeshAttached()

GetAllStaticMeshAttached

Gets all Static Meshes attached to this entity

β€” Returns of (the key as the Attached ID, and the value as the Asset Path).

local ret = my_vehicle:GetAllStaticMeshAttached()

GetDoors

Gets all configured Doors

β€” Returns ().

local ret = my_vehicle:GetDoors()

GetMesh

Gets the Asset name

β€” Returns (asset path).

local ret = my_vehicle:GetMesh()

GetPassenger

Gets a passenger from a seat

β€” Returns Character (or nil if no passenger in seat).

local ret = my_vehicle:GetPassenger(seat)
TypeParameterDefaultDescription
seat Required parameter No description provided

GetPassengers

Gets all passengers

β€” Returns of Character.

local ret = my_vehicle:GetPassengers()

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?)
TypeParameterDefaultDescription
animation_path Required parameter No description provided
slot_name?DefaultSlotNo description provided
loop_indefinitely?falseThis parameter is only used if the Vehicle has an Animation Blueprint
blend_in_time?0.25This parameter is only used if the Vehicle has an Animation Blueprint
blend_out_time?0.25This parameter is only used if the Vehicle has an Animation Blueprint
play_rate?1.0This parameter is only used if the Vehicle has an Animation Blueprint
stop_all_montages?falseStops all running Montages from the same Group. This parameter is only used if the Vehicle has an Animation Blueprint

RemoveAllSkeletalMeshesAttached

Removes all SkeletalMeshes attached

my_vehicle:RemoveAllSkeletalMeshesAttached()

RemoveAllStaticMeshesAttached

Removes all StaticMeshes attached

my_vehicle:RemoveAllStaticMeshesAttached()

RemoveSkeletalMeshAttached

Removes, if it exists, a SkeletalMesh from this Pickable given its custom ID

my_vehicle:RemoveSkeletalMeshAttached(id)
TypeParameterDefaultDescription
id Required parameter Unique ID of the SkeletalMesh to remove

See also AddSkeletalMeshAttached.


RemoveStaticMeshAttached

Removes, if it exists, a StaticMesh from this Pickable given its custom ID

my_vehicle:RemoveStaticMeshAttached(id)
TypeParameterDefaultDescription
id Required parameter Unique ID of the StaticMesh to remove

See also AddStaticMeshAttached.


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)
TypeParameterDefaultDescription
seat_index Required parameter No description provided
Vectoroffset_location Required parameter No description provided
Vectorseat_location Required parameter No description provided
Rotatorseat_rotation Required parameter No description provided
trigger_radius Required parameter No description provided
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)

SetExplosionSettings

Configures the Explosion Settings when health reaches zero

my_vehicle:SetExplosionSettings(engine_relative_location, materials_index_burnt_override, materials_index_burnt_invisible)
TypeParameterDefaultDescription
Vectorengine_relative_location Required parameter Relative location of the Engine. Used to apply particles and effects.
materials_index_burnt_override Required parameter List of material indexes to override to burnt when exploded. Leave it empty for all indexes.
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 })

SetStaticMeshAttachedTransform

Sets a Static Mesh Attached location and rotation

my_vehicle:SetStaticMeshAttachedTransform(id, relative_location, relative_rotation)
TypeParameterDefaultDescription
id Required parameter Unique ID of the StaticMesh set with AddStaticMeshAttached
Vectorrelative_location Required parameter New relative location
Rotatorrelative_rotation Required parameter New relative rotation

See also AddStaticMeshAttached.

πŸš€ Events​

NameDescription
Triggered when a Character attempts to enter the Vehicle
Triggered when a Character attempts to leave the Vehicle
Triggered when a Character fully enters the Vehicle
Triggered when a Character fully leaves the Vehicle
Triggered when Vehicle hits something
Triggered when this Vehicle takes damage

CharacterAttemptEnter

Triggered when a Character attempts to enter the Vehicle

Return false to prevent it
Vehicle.Subscribe("CharacterAttemptEnter", function(self, character, seat)
-- CharacterAttemptEnter was called
end)
TypeArgumentDescription
selfNo description provided
CharactercharacterNo description provided
seatThe seat index

CharacterAttemptLeave

Triggered when a Character attempts to leave the Vehicle

Return false to prevent it
Vehicle.Subscribe("CharacterAttemptLeave", function(self, character)
-- CharacterAttemptLeave was called
end)
TypeArgumentDescription
selfNo description provided
CharactercharacterNo description provided

CharacterEnter

Triggered when a Character fully enters the Vehicle
Vehicle.Subscribe("CharacterEnter", function(self, character, seat)
-- CharacterEnter was called
end)
TypeArgumentDescription
selfNo description provided
CharactercharacterNo description provided
seatThe seat index

CharacterLeave

Triggered when a Character fully leaves the Vehicle
Vehicle.Subscribe("CharacterLeave", function(self, character)
-- CharacterLeave was called
end)
TypeArgumentDescription
selfNo description provided
CharactercharacterNo description provided

Hit

Triggered when Vehicle hits something
Vehicle.Subscribe("Hit", function(self, impact_force, normal_impulse, impact_location, velocity)
-- Hit was called
end)
TypeArgumentDescription
selfNo description provided
impact_forceThe intensity of the Hit normalized by the Vehicle's weight
Vectornormal_impulseThe impulse direction it hits
Vectorimpact_locationThe world 3D location of the impact
VectorvelocityThe Vehicle velocity at the moment it hits

TakeDamage

Triggered when this Vehicle takes damage

Return false to cancel the damage (will still display animations, particles and apply impact forces)
Vehicle.Subscribe("TakeDamage", function(self, damage, bone, type, from_direction, instigator, causer)
-- TakeDamage was called
end)
TypeArgumentDescription
selfNo description provided
damageNo description provided
boneDamaged bone
typeDamage Type
Vectorfrom_directionDirection of the damage relative to the damaged actor
PlayerinstigatorThe player which caused the damage
causerThe object which caused the damage