基础 Pawn
所有角色实体的基类。
Classes that share methods and events from this Base Class: Character, CharacterSimple.
🦠 函数
Slow

AddSkeletalMeshAttached
生成并附加一个骨骼网格体到此实体,该骨骼网格体必须使用与此 Actor 的网格相同的骨骼,并且将同步其所有动画。使用自定义 ID 以便随后进行移除/自定义设置
my_pawn: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? | | 要附加到的骨骼插槽。传入空字符串以附加到根组件(即胶囊体)。传入 'root' 以附加到主骨骼网格体组件的根骨骼 |
| 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_pawn: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.
Optimal

Follow
AI:让该角色跟随另一个 Actor
触发事件 MoveComplete
my_pawn:Follow(actor, acceptance_radius?, stop_on_succeed?, stop_on_fail?, update_rate?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Base Actor | actor | Required parameter | 要跟随的 Actor |
| float | acceptance_radius? | 50 | 判定为成功的半径范围 |
| boolean | stop_on_succeed? | false | 到达目标时是否停止 |
| boolean | stop_on_fail? | false | 未能到达目标时是否停止 |
| float | update_rate? | 0.25 | 重新计算 AI 路径的频率 |
See also StopMovement, MoveTo, GetMovingTo, MoveComplete.
Moderate

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

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

GetCanCrouch
获取是否允许此角色下蹲
local can_crouch = my_pawn:GetCanCrouch()
Returns
| Type | Description |
|---|---|
| boolean | can_crouch |
See also SetCanCrouch.
Optimal

GetCanJump
获取是否允许此角色跳跃
local can_jump = my_pawn:GetCanJump()
Returns
| Type | Description |
|---|---|
| boolean | can_jump |
See also SetCanJump.
Optimal

GetCapsuleSize
获取胶囊体大小
local capsule_sizes = my_pawn:GetCapsuleSize()
Returns
| Type | Description |
|---|---|
| table | capsule_sizes with this format |
See also SetCapsuleSize.
Optimal

GetControlRotation
获取控制旋转
local control_rotation = my_pawn:GetControlRotation()
Returns
| Type | Description |
|---|---|
| Rotator | control_rotation |
See also SetControlRotation.
Optimal

GetFlyingMode
获取是否处于飞行模式
local flying_mode = my_pawn:GetFlyingMode()
Returns
| Type | Description |
|---|---|
| boolean | flying_mode |
See also SetFlyingMode.
Optimal

GetGravityScale
获取重力缩放值
local gravity_scale = my_pawn:GetGravityScale()
Returns
| Type | Description |
|---|---|
| float | gravity_scale |
See also SetGravityScale.
Optimal

GetMesh
获取基础网格体资产
local skeletal_mesh_asset = my_pawn:GetMesh()
Returns
| Type | Description |
|---|---|
| SkeletalMesh Reference | skeletal_mesh_asset |
Optimal

GetMovingTo
获取正在移动去往的位置
local location = my_pawn:GetMovingTo()
Returns
| Type | Description |
|---|---|
| Vector | 正在移动去往的位置,如果未移动则返回 Vector(0, 0, 0) |
Optimal

GetPlayer
获取当前控制此实体的玩家
local possesser = my_pawn:GetPlayer()
Optimal

HideBone
隐藏此角色的某根骨骼。
请查看骨骼名称列表
my_pawn:HideBone(bone_name?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | bone_name? | | 要隐藏的骨骼 |
See also UnHideBone, IsBoneHidden.
Optimal

IsBoneHidden
获取某根骨骼是否被隐藏
local is_hidden = my_pawn:IsBoneHidden(bone_name)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | bone_name | Required parameter | 要检查的骨骼 |
Returns
| Type | Description |
|---|---|
| boolean | 骨骼是否被隐藏 |
See also UnHideBone, HideBone.
Optimal

Jump
触发此角色进行跳跃
my_pawn:Jump()
Optimal

MoveTo
AI:让该角色步行移动到指定位置
触发事件 MoveComplete
my_pawn:MoveTo(location, acceptance_radius?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | No description provided |
| float | acceptance_radius? | 50 | No description provided |
See also StopMovement, Follow, GetMovingTo, MoveComplete.
Optimal

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

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

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

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

SetAIAvoidanceSettings
AI:配置 AI 移动时使用的 RVO(相互速度障碍物)避让系统
my_pawn:SetAIAvoidanceSettings(enabled, avoidance_consideration_radius?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | enabled | Required parameter | 是否启用 RVO 避让 |
| integer | avoidance_consideration_radius? | 300 | 用于确定避让距离的圆半径 |
Optimal

SetBrakingSettings
设置此角色的移动制动设置
my_pawn:SetBrakingSettings(ground_friction?, braking_friction_factor?, braking_walking?, braking_flying?, braking_swimming?, braking_falling?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | ground_friction? | 2 | No description provided |
| float | braking_friction_factor? | 2 | No description provided |
| integer | braking_walking? | 96 | No description provided |
| integer | braking_flying? | 3000 | No description provided |
| integer | braking_swimming? | 10 | No description provided |
| integer | braking_falling? | 0 | No description provided |
Optimal

SetCanCrouch
设置是否允许此角色下蹲
my_pawn:SetCanCrouch(can_crouch)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | can_crouch | Required parameter | No description provided |
See also GetCanCrouch.
Optimal

SetCanJump
设置此角色是否被允许跳跃
my_pawn:SetCanJump(can_jump)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | can_jump | Required parameter | No description provided |
See also GetCanJump.
Optimal

SetCapsuleSize
设置此角色的胶囊体大小(将影响相机位置以及角色的碰撞判定)
my_pawn:SetCapsuleSize(radius?, half_height?, crouched_half_height?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | radius? | 0 | 传入 0 以根据网格体边界自动计算半径 |
| integer | half_height? | 0 | 传入 0 以根据网格体边界自动计算半高 |
| integer | crouched_half_height? | 0 | 传入 0 以根据网格体边界自动计算下蹲半高 |
See also GetCapsuleSize.
Optimal

SetControlRotation
设置控制旋转
my_pawn:SetControlRotation(control_rotation)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Rotator | control_rotation | Required parameter | No description provided |
See also GetControlRotation.
Optimal

SetFlyingMode
设置飞行模式
my_pawn:SetFlyingMode(flying_mode)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | flying_mode | Required parameter | No description provided |
See also GetFlyingMode.
Optimal

SetGravityScale
更改此角色的重力缩放值(可以为负数)
my_pawn:SetGravityScale(gravity_scale)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | gravity_scale | Required parameter | No description provided |
See also GetGravityScale.
Optimal

SetHitReactionEnabled
设置角色在受到伤害时是否触发受击反应,通过对受损的本地骨骼应用微小的动态布娃娃效果
my_pawn:SetHitReactionEnabled(is_enabled)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | is_enabled | Required parameter | No description provided |
Moderate

SetJumpZVelocity
设置跳跃的速度
my_pawn:SetJumpZVelocity(jump_z_velocity)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | jump_z_velocity | Required parameter | 默认值为 450 |
Optimal

SetMeshSettings
配置网格体附加设置和可见性
my_pawn:SetMeshSettings(relative_location?, relative_rotation?, is_visible?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | relative_location? | Vector(0, 0, 0) | No description provided |
| Rotator | relative_rotation? | Rotator(0, -90, 0) | No description provided |
| bool | is_visible? | true | 网格体是否可见(在使用子网格体的重定向器时很有用) |
Optimal

SetRagdollOnDeathEnabled
设置角色死亡时是否进入布娃娃模式。你可以将其设置为 false 以应用自定义死亡动画
my_pawn:SetRagdollOnDeathEnabled(is_enabled)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | is_enabled | Required parameter | No description provided |
Moderate

SetStaticMeshAttachedTransform
设置已附加静态网格体的位置和旋转
my_pawn: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_pawn:StopAnimation(animation_asset)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Animation Reference | animation_asset | Required parameter | No description provided |
Optimal

StopMovement
AI:停止移动,可选将速度归零(非 AI 也会停止)
触发事件 MoveComplete
my_pawn:StopMovement(stops_velocity?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | stops_velocity? | false | 同时停止 Pawn 的当前速度 |
See also Follow, MoveTo, GetMovingTo, MoveComplete.
Optimal

UnHideBone
取消隐藏此角色的某根骨骼。
请查看骨骼名称列表
my_pawn:UnHideBone(bone_name)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | bone_name | Required parameter | 要取消隐藏的骨骼 |
See also HideBone, IsBoneHidden.
🚀 事件
| Name | Description | |
|---|---|---|
AnimationBeginNotify | 当动画蒙太奇通知开始时 | |
AnimationEndNotify | 当动画蒙太奇通知结束时 | |
MoveComplete | 当 AI 到达目的地或失败时调用 | |
Possess | 当角色被玩家控制时 | |
UnPossess | 当角色被玩家取消控制时 |

AnimationBeginNotify
当动画蒙太奇通知开始时
<AnyPawnClass>.Subscribe("AnimationBeginNotify", function(self, notify_name, animation_name, trigger_begin_time, trigger_end_time)
-- AnimationBeginNotify was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Character | self | No description provided |
| string | notify_name | No description provided |
| string | animation_name | No description provided |
| number | trigger_begin_time | No description provided |
| number | trigger_end_time | No description provided |

AnimationEndNotify
当动画蒙太奇通知结束时
<AnyPawnClass>.Subscribe("AnimationEndNotify", function(self, notify_name, animation_name, trigger_begin_time, trigger_end_time)
-- AnimationEndNotify was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Character | self | No description provided |
| string | notify_name | No description provided |
| string | animation_name | No description provided |
| number | trigger_begin_time | No description provided |
| number | trigger_end_time | No description provided |

MoveComplete
当 AI 到达目的地或失败时调用
<AnyPawnClass>.Subscribe("MoveComplete", function(self, succeeded)
-- MoveComplete was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Pawn | self | No description provided |
| boolean | succeeded | No description provided |
See also StopMovement, MoveTo, Follow, GetMovingTo.

Possess
当角色被玩家控制时
<AnyPawnClass>.Subscribe("Possess", function(self, player)
-- Possess was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Pawn | self | No description provided |
| Player | player | No description provided |
See also UnPossess, GetPlayer.

UnPossess
当角色被玩家取消控制时
<AnyPawnClass>.Subscribe("UnPossess", function(self, old_player)
-- UnPossess was called
end)


