Skip to main content
Version: bleeding-edge 🩸

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
AddSkeletalMeshAttachedAttaches a Skeletal Mesh as master pose to this entity
AddStaticMeshAttachedAttaches a Static Mesh to this entity
table of stringGetAllSkeletalMeshAttachedGets all Skeletal Meshes attached to this entity
table of stringGetAllStaticMeshAttachedGets all Static Meshes attached to this entity
tableGetBoneTransformGets a Bone Transform in world space given a bone name
tableGetDoorsGets all configured Doors
SkeletalMesh ReferenceGetMeshGets the Asset name
CharacterGetPassengerGets a passenger from a seat
table of CharacterGetPassengersGets all passengers
PlayAnimationPlays an Animation on this Vehicle
RemoveAllSkeletalMeshesAttachedRemoves all SkeletalMeshes attached
RemoveAllStaticMeshesAttachedRemoves all StaticMeshes attached
RemoveSkeletalMeshAttachedRemoves, if it exists, a SkeletalMesh from this Pickable given its custom ID
RemoveStaticMeshAttachedRemoves, if it exists, a StaticMesh from this Pickable given its custom ID
SetDoorAdds a Door to the Vehicle
SetExplosionSettingsConfigures the Explosion Settings when health reaches zero
SetStaticMeshAttachedTransformSets 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
stringid Required parameter Used further for removing or applying material settings on it
SkeletalMesh Referenceskeletal_mesh_path Required parameter Path to SkeletalMesh asset to attach
booleanuse_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
stringid Required parameter Unique ID to assign to the StaticMesh
StaticMesh Referencestatic_mesh_path Required parameter Path to StaticMesh asset to attach
stringsocket?Bone socket to attach to
Vectorrelative_location?Vector(0, 0, 0)Relative location
Rotatorrelative_rotation?Rotator(0, 0, 0)Relative rotation
booleanuse_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 table of string (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 table of string (the key as the Attached ID, and the value as the Asset Path).

local ret = my_vehicle:GetAllStaticMeshAttached()

GetBoneTransform

Gets a Bone Transform in world space given a bone name

— Returns table (with this format).

local ret = my_vehicle:GetBoneTransform(bone_name)
TypeParameterDefaultDescription
stringbone_name Required parameter No description provided

GetDoors

Gets all configured Doors

— Returns table (with this format).

local ret = my_vehicle:GetDoors()

GetMesh

Gets the Asset name

— Returns SkeletalMesh Reference (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
integerseat Required parameter No description provided

GetPassengers

Gets all passengers

— Returns table 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 Referenceanimation_path Required parameter No description provided
stringslot_name?DefaultSlotNo description provided
booleanloop_indefinitely?falseThis parameter is only used if the Vehicle has an Animation Blueprint
floatblend_in_time?0.25This parameter is only used if the Vehicle has an Animation Blueprint
floatblend_out_time?0.25This parameter is only used if the Vehicle has an Animation Blueprint
floatplay_rate?1.0This parameter is only used if the Vehicle has an Animation Blueprint
booleanstop_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
stringid 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
stringid 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
integerseat_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
integertrigger_radius Required parameter No description provided
integerleave_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.
tablematerials_index_burnt_override Required parameter List of material indexes to override to burnt when exploded. Leave it empty for all indexes.
tablematerials_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
stringid 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
CharacterAttemptEnterTriggered when a Character attempts to enter the Vehicle
CharacterAttemptLeaveTriggered when a Character attempts to leave the Vehicle
CharacterEnterTriggered when a Character fully enters the Vehicle
CharacterLeaveTriggered when a Character fully leaves the Vehicle
HitTriggered when Vehicle hits something
TakeDamageTriggered 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
Base VehicleselfNo description provided
CharactercharacterNo description provided
integerseatThe 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
Base VehicleselfNo 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
Base VehicleselfNo description provided
CharactercharacterNo description provided
integerseatThe seat index

CharacterLeave

Triggered when a Character fully leaves the Vehicle
Vehicle.Subscribe("CharacterLeave", function(self, character)
-- CharacterLeave was called
end)
TypeArgumentDescription
Base VehicleselfNo 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
Base VehicleselfNo description provided
integerimpact_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
Base VehicleselfNo description provided
integerdamageNo description provided
stringboneDamaged bone
DamageTypetypeDamage Type
Vectorfrom_directionDirection of the damage relative to the damaged actor
PlayerinstigatorThe player which caused the damage
anycauserThe object which caused the damage