基础载具
所有载具实体的基类。
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.
🦠 函数
Slow

AddSkeletalMeshAttached
生成并附加一个骨骼网格体到此实体,该骨骼网格体必须使用与此 Actor 的网格相同的骨骼,并且将同步其所有动画。使用自定义 ID 以便随后进行移除/自定义设置
🆕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 | 后续用于移除或在其上应用材质设置 |
| SkeletalMesh Reference | skeletal_mesh_path | Required parameter | 要附加的骨骼网格体资产路径 |
| string | socket? | | 要附加到的骨骼插槽 |
| Vector | relative_location? | Vector(0, 0, 0) | 相对位置 |
| Rotator | relative_rotation? | Rotator(0, 0, 0) | 相对旋转 |
| boolean | use_parent_bounds? | true | 如果为 true,则该组件在附加时使用其父级的边界。当附加许多组件时,这可以带来显著的优化 |
| boolean | use_base_leader_pose_component? | true | 如果为 true,此组件将使用基础领头姿态组件来复制其动画 |
| Animation Reference | animation_path? | | 要在附加的骨骼网格体上播放的动画资产路径 |
| string | attachable_id? | | 可选,将此组件附加到另一个已附加的骨骼网格体上(而不是附加到根组件上) |
See also RemoveSkeletalMeshAttached.
Slow

AddStaticMeshAttached
在插槽中以相对位置和旋转生成并附加一个静态网格体到此载具。使用自定义 ID 以便随后进行移除/自定义设置
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 | 分配给该静态网格体的唯一 ID |
| StaticMesh Reference | static_mesh_path | Required parameter | 要附加的静态网格体资产路径 |
| string | socket? | | 要附加到的骨骼插槽 |
| Vector | relative_location? | Vector(0, 0, 0) | 相对位置 |
| Rotator | relative_rotation? | Rotator(0, 0, 0) | 相对旋转 |
| boolean | use_parent_bounds? | true | 如果为 true,则该组件在附加时使用其父级的边界。当附加许多组件时,这可以带来显著的优化 |
| string | attachable_id? | | 可选,将此组件附加到另一个已附加的静态网格体上(而不是附加到根组件上) |
See also SetStaticMeshAttachedTransform, RemoveStaticMeshAttached.
Slow

BindAnimationBlueprintEventDispatcher
指定并绑定动画蓝图事件分发器。
注:仅 VehicleWheeled 拥有动画蓝图,对任何其他载具类型调用此函数均不起作用。
local ret = my_vehicle:BindAnimationBlueprintEventDispatcher(dispatcher_name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | dispatcher_name | Required parameter | 事件分发器名称 |
| function | callback | Required parameter | 要调用的回调函数 with this format |
Returns
| Type | Description |
|---|---|
| function | 回调函数本身 |
Slow

CallAnimationBlueprintEvent
调用动画蓝图事件或函数。
在客户端返回所有函数返回值。
注:仅 VehicleWheeled 拥有动画蓝图,对任何其他载具类型调用此函数均不起作用。
local ret_01, ret_02, ... = my_vehicle:CallAnimationBlueprintEvent(event_name, arguments...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | 事件或函数名称 |
| any | arguments...? | nil | 要传递给该事件的参数序列 |
Optimal

GetAllSkeletalMeshAttached
获取附加到此实体的所有骨骼网格体
local ret = my_vehicle:GetAllSkeletalMeshAttached()
Optimal

GetAllStaticMeshAttached
获取附加到此实体的所有静态网格体
local ret = my_vehicle:GetAllStaticMeshAttached()
Slow

GetAnimationBlueprintPropertyValue
直接获取动画蓝图属性/变量的值。
注:仅 VehicleWheeled 拥有动画蓝图,对任何其他载具类型调用此函数将返回nil。
local ret = my_vehicle:GetAnimationBlueprintPropertyValue(property_name)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | property_name | Required parameter | No description provided |
Returns
| Type | Description |
|---|---|
| any | 属性值 |
See also SetAnimationBlueprintPropertyValue.
Moderate

GetDoors
获取所有配置的门
local ret = my_vehicle:GetDoors()
Returns
| Type | Description |
|---|---|
| table | with this format |
Optimal

GetMesh
获取资产名称
local asset = my_vehicle:GetMesh()
Returns
| Type | Description |
|---|---|
| SkeletalMesh Reference | 资产路径 |
Optimal

GetPassenger
获取指定座位上的乘客
local passenger = my_vehicle:GetPassenger(seat)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | seat | Required parameter | No description provided |
Returns
| Type | Description |
|---|---|
| Character | 如果座位上没有乘客则返回 nil |
Moderate

GetPassengers
获取所有乘客
local passengers = my_vehicle:GetPassengers()
Optimal

IsEngineStarted
检查引擎是否已启动
local is_started = my_vehicle:IsEngineStarted()
Returns
| Type | Description |
|---|---|
| boolean | is_started |
Moderate

PlayAnimation
在此载具上播放动画
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 | 仅当载具拥有动画蓝图时使用此参数 |
| float | blend_in_time? | 0.25 | 仅当载具拥有动画蓝图时使用此参数 |
| float | blend_out_time? | 0.25 | 仅当载具拥有动画蓝图时使用此参数 |
| float | play_rate? | 1.0 | 仅当载具拥有动画蓝图时使用此参数 |
| boolean | stop_all_montages? | false | 停止来自同一组的所有正在运行的动画蒙太奇。该参数仅在载具拥有动画蓝图时使用 |
Optimal

RemoveAllSkeletalMeshesAttached
移除所有已附加的骨骼网格体
my_vehicle:RemoveAllSkeletalMeshesAttached()
Optimal

RemoveAllStaticMeshesAttached
移除所有已附加的静态网格体
my_vehicle:RemoveAllStaticMeshesAttached()
Optimal

RemoveSkeletalMeshAttached
根据自定义 ID 移除此载具上已存在的骨骼网格体(如果存在)
my_vehicle:RemoveSkeletalMeshAttached(id)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | id | Required parameter | 要移除的骨骼网格体的唯一 ID |
See also AddSkeletalMeshAttached.
Optimal

RemoveStaticMeshAttached
根据自定义 ID 移除此载具上已存在的静态网格体(如果存在)
my_vehicle:RemoveStaticMeshAttached(id)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | id | Required parameter | 要移除的静态网格体的唯一 ID |
See also AddStaticMeshAttached.
Slow

SetAnimationBlueprintPropertyValue
在构造函数中传入的动画蓝图上直接设置其属性/变量的值。
注:仅 VehicleWheeled 拥有动画蓝图,对任何其他载具类型调用此函数均不起作用。
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
设置用于让该实体浮于水面上的球形浮筒,这将覆盖根据网格体边界和质量自动计算出的浮筒。
不传值(或传入空表)可恢复为自动计算的浮筒。
浮筒仅在启用了水体浮力的地图中生效
my_vehicle:SetBuoyancyPontoons(pontoons?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| table | pontoons? | nil | 包含浮筒数据的数组,传入 nil 可恢复自动计算的浮筒 with this format |
Moderate

SetBuoyancySettings
传入 nil 值将恢复该设置的默认值。
在自动计算浮筒时,修改 buoyancy_coefficient 也会同步重新计算浮筒,因为浮筒半径是由该系数推算出来的。
my_vehicle:SetBuoyancySettings(enabled?, buoyancy_coefficient?, buoyancy_damp?, max_buoyant_force?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | enabled? | true | 是否施加浮力 |
| float | buoyancy_coefficient? | 0.1 | 漂浮的程度,越高程度越大 |
| float | buoyancy_damp? | 1000 | 垂直速度的一阶阻尼,用于减少起伏 |
| float | max_buoyant_force? | 5000000 | 向上力的最大限制值,防止较轻的物体被直接弹飞出水面 |
Optimal

SetCameraArmLength
设置驾驶此载具时摄像机与载具保持的距离(厘米)。
在玩家驾驶载具期间,这将覆盖玩家自身的相机臂长度。设为0则改用玩家原本的值(这也是默认设置)。
my_vehicle:SetCameraArmLength(arm_length)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | arm_length | Required parameter | 距离(厘米),或设为 0 以使用玩家自带的值 |
Optimal

SetCameraOffset
设置载具相机偏移量
my_vehicle:SetCameraOffset(offset)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | offset | Required parameter | No description provided |
Optimal

SetDoor
在距离根节点 offset_location 偏移量处添加一个车门,并将角色放置在 seat_location 位置且应用 seat_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 | 角色离开载具时将被弹出的位置(例如,左车门为 -150,右车门为 150) |
Optimal

SetExplosionSettings
配置当生命值归零时的爆炸设置
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 | 引擎的相对位置。用于应用粒子和特效。 |
| table | materials_index_burnt_override | Required parameter | 爆炸时覆盖为烧毁效果的材质索引列表。留空则作用于所有索引。 |
| table | materials_index_burnt_invisible | Required parameter | 爆炸时覆盖为不可见的材质索引列表。留空则作用于所有索引。 |
Vehicle.SetExplosionSettings Examples
Vehicle Explosion Settings
my_vehicle:SetExplosionSettings(Vector(-50, 0, 0), { 1, 2, 4 }, { 3 })
Optimal

SetStaticMeshAttachedTransform
设置已附加静态网格体的位置和旋转
my_vehicle:SetStaticMeshAttachedTransform(id, relative_location, relative_rotation)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | id | Required parameter | 通过 AddStaticMeshAttached 设置的静态网格体的唯一 ID |
| Vector | relative_location | Required parameter | 新的相对位置 |
| Rotator | relative_rotation | Required parameter | 新的相对旋转 |
See also AddStaticMeshAttached.
Optimal

StopAnimation
停止在此载具上播放的动画蒙太奇
my_vehicle:StopAnimation(animation_asset?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Animation Reference | animation_asset? | | 留空以停止所有蒙太奇 |
Optimal

UnbindAnimationBlueprintEventDispatcher
解绑一个动画蓝图事件分发器
my_vehicle:UnbindAnimationBlueprintEventDispatcher(dispatcher_name, callback?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | dispatcher_name | Required parameter | 事件分发器名称 |
| function | callback? | nil | 可选的要解绑的回调函数 |
🚀 事件
| Name | Description | |
|---|---|---|
CharacterAttemptEnter | 当角色尝试进入载具时触发 | |
CharacterAttemptLeave | 当角色尝试离开载具时触发 | |
CharacterEnter | 当角色完全进入载具时触发 | |
CharacterLeave | 当角色完全离开载具时触发 | |
EngineStart | 引擎启动时触发 | |
EngineStop | 引擎停止时触发 | |
Hit | 当载具撞击到某物时触发 |

CharacterAttemptEnter
当角色尝试进入载具时触发
返回 false 以阻止该行为
<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 | 座位索引 |

CharacterAttemptLeave
当角色尝试离开载具时触发
返回 false 以阻止该行为
<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
当角色完全进入载具时触发
<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
当角色完全离开载具时触发
<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
引擎启动时触发
<AnyVehicleClass>.Subscribe("EngineStart", function(self)
-- EngineStart was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |

EngineStop
引擎停止时触发
<AnyVehicleClass>.Subscribe("EngineStop", function(self)
-- EngineStop was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Vehicle | self | No description provided |

Hit
当载具撞击到某物时触发
<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 | 按载具重量归一化后的撞击强度 |
| Vector | normal_impulse | 撞击的冲量方向 |
| Vector | impact_location | 撞击在世界 3D 空间中的位置 |
| Vector | velocity | 载具撞击瞬间的速度 |
| Base Actor or nil | other_actor | 撞击该载具的另一个 Actor |


