Ir para o conteúdo principal
Version: latest - a1.156.0 ⚖️

Base Pawn

Base class for all Pawn entities (Character and CharacterSimple).

👪Base Class🧑‍💻API 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: Character, CharacterSimple.

🦠 Functions​

ReturnsNameDescription
AddSkeletalMeshAttachedAttaches a Skeletal Mesh as master pose to this entity
AddStaticMeshAttachedAttaches a Static Mesh to this entity
FollowAI: Makes this Pawn follow another actor
table of stringGetAllSkeletalMeshAttachedGets all Skeletal Meshes attached to this entity
table of stringGetAllStaticMeshAttachedGets all Static Meshes attached to this entity
booleanGetCanCrouchGets if this Pawn is allowed to Crouch
booleanGetCanJumpGets if this Pawn is allowed to Jump
tableGetCapsuleSizeGets the Capsule Size
RotatorGetControlRotationGets the Control Rotation, which is where this Pawn is looking or aiming
booleanGetFlyingModeGets if it's in Flying mode
floatGetGravityScaleGets the gravity scale
integerGetJumpZVelocityGets the initial vertical velocity when jumping, which defines the jump height
SkeletalMesh ReferenceGetMeshGets the base Mesh Asset
VectorGetMovingToGets the Moving To location
Player or nilGetPlayerGets the possessing Player
HideBoneHides a bone of this Pawn
booleanIsBoneHiddenGets if a bone is hidden
JumpTriggers this Pawn to jump
MoveToAI: Makes this Pawn walk to the Location
RemoveAllSkeletalMeshesAttachedRemoves all SkeletalMeshes attached
RemoveAllStaticMeshesAttachedRemoves all StaticMeshes attached
RemoveSkeletalMeshAttachedRemoves, if it exists, a SkeletalMesh from this entity given its custom ID
RemoveStaticMeshAttachedRemoves, if it exists, a StaticMesh from this entity given its custom ID
SetAIAvoidanceSettingsAI: Configures the RVO (Reciprocal Velocity Obstacles) Avoidance system used by the AIs when moving
SetBrakingSettingsSets the Movement Braking Settings of this Pawn
SetCanCrouchSets if this Pawn is allowed to Crouch
SetCanJumpSets if this Pawn is allowed to Jump
SetCapsuleSizeSets this Pawn's Capsule size
SetControlRotationSets the Control Rotation, which is where this Pawn is looking or aiming
SetFlyingModeEnables or disables the Flying Mode, which removes gravity and allows moving in all directions
SetGravityScaleChanges the Gravity Scale
SetHitReactionEnabledSets if the character will react to damage by applying small dynamic ragdoll effect to local bones damaged
SetJumpZVelocitySets the velocity of the jump
SetMeshSettingsConfigures the mesh attachment settings and visibility
SetRagdollOnDeathEnabledSets if the character will enter ragdoll mode when it dies. You can set it to false to apply custom Death animations
SetStaticMeshAttachedTransformSets a Static Mesh Attached location and rotation
StopAnimationStops an Animation Montage on this character
StopMovementAI: Stops the movement, optionally zeroing the velocity as well
UnHideBoneUnhides a bone of this Pawn

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_pawn:AddSkeletalMeshAttached(id, skeletal_mesh_path, socket?, relative_location?, relative_rotation?, use_parent_bounds?, use_base_leader_pose_component?, animation_path?, attachable_id?)

Parameters

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
stringsocket?
Bone socket to attach to. Pass empty string to attach to the root component (i.e. Capsule). Pass 'root' to attach to the root bone of the main skeletal mesh component
Vectorrelative_location?Vector(0, 0, 0)
Relative location
Rotatorrelative_rotation?Rotator(0, 0, 0)
Relative rotation
booleanuse_parent_bounds?true
If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together
booleanuse_base_leader_pose_component?true
If true, this component will use the base leader pose component for copying its animation
Animation Referenceanimation_path?
Path to Animation asset to play on the Skeletal Mesh attached
stringattachable_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 entity in a Socket with a relative location and rotation. Uses a custom ID to be used for removing/customizing it afterwards
my_pawn:AddStaticMeshAttached(id, static_mesh_path, socket?, relative_location?, relative_rotation?, use_parent_bounds?, attachable_id?)

Parameters

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?true
If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together
stringattachable_id?
Optionally attaches this to another attached static mesh (instead of attaching to the root component)

See also SetStaticMeshAttachedTransform, RemoveStaticMeshAttached.


Optimal

Follow​

AI: Makes this Pawn follow another actor

Triggers event MoveComplete
my_pawn:Follow(actor, acceptance_radius?, stop_on_succeed?, stop_on_fail?, update_rate?)

Parameters

TypeParameterDefaultDescription
Base Actoractor Required parameter Actor to follow
floatacceptance_radius?50
Radius to consider success
booleanstop_on_succeed?false
Whether to stop when reaching the target
booleanstop_on_fail?false
Whether to stop when failed to reach the target
floatupdate_rate?0.25
How often to recalculate the AI path

See also StopMovement, MoveTo, GetMovingTo, MoveComplete.


Moderate

GetAllSkeletalMeshAttached​

Gets all Skeletal Meshes attached to this entity
local ret = my_pawn:GetAllSkeletalMeshAttached()

Returns

TypeDescription
table of stringthe key as the Attached ID, and the value as the Asset Path

Moderate

GetAllStaticMeshAttached​

Gets all Static Meshes attached to this entity
local ret = my_pawn:GetAllStaticMeshAttached()

Returns

TypeDescription
table of stringthe key as the Attached ID, and the value as the Asset Path

Optimal

GetCanCrouch​

Gets if this Pawn is allowed to Crouch
local can_crouch = my_pawn:GetCanCrouch()

Returns

TypeDescription
booleanWhether this Pawn is allowed to Crouch

See also SetCanCrouch.


Optimal

GetCanJump​

Gets if this Pawn is allowed to Jump
local can_jump = my_pawn:GetCanJump()

Returns

TypeDescription
booleanWhether this Pawn is allowed to Jump

See also SetCanJump.


Optimal

GetCapsuleSize​

Gets the Capsule Size
local capsule_sizes = my_pawn:GetCapsuleSize()

Returns

TypeDescription
tableCapsule Size with this format

See also SetCapsuleSize.


Optimal

GetControlRotation​

Gets the Control Rotation, which is where this Pawn is looking or aiming
local control_rotation = my_pawn:GetControlRotation()

Returns

TypeDescription
RotatorControl Rotation

See also SetControlRotation.


Optimal

GetFlyingMode​

Gets if it's in Flying mode
local flying_mode = my_pawn:GetFlyingMode()

Returns

TypeDescription
booleanWhether it's in Flying mode

See also SetFlyingMode.


Optimal

GetGravityScale​

Gets the gravity scale
local gravity_scale = my_pawn:GetGravityScale()

Returns

TypeDescription
floatGravity scale

See also SetGravityScale.


Optimal

GetJumpZVelocity​

Gets the initial vertical velocity when jumping, which defines the jump height
local jump_z_velocity = my_pawn:GetJumpZVelocity()

Returns

TypeDescription
integerJump Z Velocity

See also SetJumpZVelocity.


Optimal

GetMesh​

Gets the base Mesh Asset
local skeletal_mesh_asset = my_pawn:GetMesh()

Returns

TypeDescription
SkeletalMesh ReferenceBase Mesh Asset

Optimal

GetMovingTo​

Gets the Moving To location
local location = my_pawn:GetMovingTo()

Returns

TypeDescription
Vectorthe moving to location or Vector(0, 0, 0) if not moving

Optimal

GetPlayer​

Gets the possessing Player
local possesser = my_pawn:GetPlayer()

Returns

TypeDescription
Player or nilPossessing Player

See also Possess, UnPossess.


Optimal

HideBone​

Hides a bone of this Pawn.

Check Bone Names List
my_pawn:HideBone(bone_name?)

Parameters

TypeParameterDefaultDescription
stringbone_name?
Bone to hide

See also UnHideBone, IsBoneHidden.


Optimal

IsBoneHidden​

Gets if a bone is hidden
local is_hidden = my_pawn:IsBoneHidden(bone_name)

Parameters

TypeParameterDefaultDescription
stringbone_name Required parameter Bone to check

Returns

TypeDescription
booleanif the bone is hidden

See also UnHideBone, HideBone.


Optimal

Jump​

Triggers this Pawn to jump
my_pawn:Jump()

Optimal

MoveTo​

AI: Makes this Pawn walk to the Location

Triggers event MoveComplete
my_pawn:MoveTo(location, acceptance_radius?)

Parameters

TypeParameterDefaultDescription
Vectorlocation Required parameter The destination
floatacceptance_radius?50
Distance from the destination considered as arrived

See also StopMovement, Follow, GetMovingTo, MoveComplete.


Optimal

RemoveAllSkeletalMeshesAttached​

Removes all SkeletalMeshes attached
my_pawn:RemoveAllSkeletalMeshesAttached()

Optimal

RemoveAllStaticMeshesAttached​

Removes all StaticMeshes attached
my_pawn:RemoveAllStaticMeshesAttached()

Optimal

RemoveSkeletalMeshAttached​

Removes, if it exists, a SkeletalMesh from this entity given its custom ID
my_pawn:RemoveSkeletalMeshAttached(id)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Unique ID of the SkeletalMesh to remove

See also AddSkeletalMeshAttached.


Optimal

RemoveStaticMeshAttached​

Removes, if it exists, a StaticMesh from this entity given its custom ID
my_pawn:RemoveStaticMeshAttached(id)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Unique ID of the StaticMesh to remove

See also AddStaticMeshAttached.


Optimal

SetAIAvoidanceSettings​

AI: Configures the RVO (Reciprocal Velocity Obstacles) Avoidance system used by the AIs when moving
my_pawn:SetAIAvoidanceSettings(enabled, avoidance_consideration_radius?)

Parameters

TypeParameterDefaultDescription
booleanenabled Required parameter Whether to enable the RVO Avoidance
integeravoidance_consideration_radius?300
The radius of the circle used to determine the avoidance distance

Optimal

SetBrakingSettings​

Sets the Movement Braking Settings of this Pawn
my_pawn:SetBrakingSettings(ground_friction?, braking_friction_factor?, braking_walking?, braking_flying?, braking_swimming?, braking_falling?)

Parameters

TypeParameterDefaultDescription
floatground_friction?2
Friction applied when walking on the ground
floatbraking_friction_factor?2
Multiplier of the friction applied when braking
integerbraking_walking?96
Deceleration when walking without input
integerbraking_flying?3000
Deceleration when flying without input
integerbraking_swimming?10
Deceleration when swimming without input
integerbraking_falling?0
Horizontal deceleration when falling without input

Optimal

SetCanCrouch​

Sets if this Pawn is allowed to Crouch
my_pawn:SetCanCrouch(can_crouch)

Parameters

TypeParameterDefaultDescription
booleancan_crouch Required parameter Whether this Pawn is allowed to Crouch

See also GetCanCrouch.


Optimal

SetCanJump​

Sets if this Pawn is allowed to Jump
my_pawn:SetCanJump(can_jump)

Parameters

TypeParameterDefaultDescription
booleancan_jump Required parameter Whether this Pawn is allowed to Jump

See also GetCanJump.


Optimal

SetCapsuleSize​

Sets this Pawn's Capsule size (will affect Camera location and the Pawn's collision)
🆕Updated Function
This method was recently updated in ver. 1.144. See the Compatibility Versions page for more information.
my_pawn:SetCapsuleSize(radius?, half_height?, crouched_half_height?)

Parameters

TypeParameterDefaultDescription
integerradius?0
Pass 0 to auto calculate the radius based on the mesh bounds
integerhalf_height?0
Pass 0 to auto calculate the half height based on the mesh bounds
integercrouched_half_height?0
Pass 0 to auto calculate the crouched half height based on the mesh bounds

See also GetCapsuleSize.


Optimal

SetControlRotation​

Sets the Control Rotation, which is where this Pawn is looking or aiming
my_pawn:SetControlRotation(control_rotation)

Parameters

TypeParameterDefaultDescription
Rotatorcontrol_rotation Required parameter The new Control Rotation

See also GetControlRotation.


Optimal

SetFlyingMode​

Enables or disables the Flying Mode, which removes gravity and allows moving in all directions
my_pawn:SetFlyingMode(flying_mode)

Parameters

TypeParameterDefaultDescription
booleanflying_mode Required parameter Whether the Flying Mode is enabled

See also GetFlyingMode.


Optimal

SetGravityScale​

Changes the Gravity Scale of this Pawn (can be negative)
my_pawn:SetGravityScale(gravity_scale)

Parameters

TypeParameterDefaultDescription
floatgravity_scale Required parameter The new Gravity Scale

See also GetGravityScale.


Optimal

SetHitReactionEnabled​

Sets if the character will react to damage by applying small dynamic ragdoll effect to local bones damaged
my_pawn:SetHitReactionEnabled(is_enabled)

Parameters

TypeParameterDefaultDescription
booleanis_enabled Required parameter Whether the character will react to damage by applying small dynamic ragdoll effect to local bones damaged

Moderate

SetJumpZVelocity​

Sets the velocity of the jump
my_pawn:SetJumpZVelocity(jump_z_velocity)

Parameters

TypeParameterDefaultDescription
integerjump_z_velocity Required parameter Default is 420

See also GetJumpZVelocity.


Optimal

SetMeshSettings​

Configures the mesh attachment settings and visibility
my_pawn:SetMeshSettings(relative_location?, relative_rotation?, is_visible?)

Parameters

TypeParameterDefaultDescription
Vectorrelative_location?Vector(0, 0, 0)
Location of the mesh relative to the capsule
Rotatorrelative_rotation?Rotator(0, -90, 0)
Rotation of the mesh relative to the capsule
booleanis_visible?true
Whether the mesh is visible (useful for using retargeters using child meshes)

Optimal

SetRagdollOnDeathEnabled​

Sets if the character will enter ragdoll mode when it dies. You can set it to false to apply custom Death animations
my_pawn:SetRagdollOnDeathEnabled(is_enabled)

Parameters

TypeParameterDefaultDescription
booleanis_enabled Required parameter Whether the character will enter ragdoll mode when it dies. You can set it to false to apply custom Death animations

Moderate

SetStaticMeshAttachedTransform​

Sets a Static Mesh Attached location and rotation
my_pawn:SetStaticMeshAttachedTransform(id, relative_location, relative_rotation)

Parameters

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.


Optimal

StopAnimation​

Stops an Animation Montage on this character
my_pawn:StopAnimation(animation_asset)

Parameters

TypeParameterDefaultDescription
Animation Referenceanimation_asset Required parameter The Animation asset to stop

Optimal

StopMovement​

AI: Stops the movement, optionally zeroing the velocity as well (stops even for non AI)

Triggers event MoveComplete
my_pawn:StopMovement(stops_velocity?)

Parameters

TypeParameterDefaultDescription
booleanstops_velocity?false
Also stops the Pawn's current velocity

See also Follow, MoveTo, GetMovingTo, MoveComplete.


Optimal

UnHideBone​

Unhides a bone of this Pawn.

Check Bone Names List
my_pawn:UnHideBone(bone_name)

Parameters

TypeParameterDefaultDescription
stringbone_name Required parameter Bone to unhide

See also HideBone, IsBoneHidden.

🚀 Events​

NameDescription
AnimationBeginNotifyWhen an Animation Montage Notify begins
AnimationEndNotifyWhen an Animation Montage Notify ends
MoveCompleteCalled when AI reaches its destination, or when it fails
PossessWhen this Pawn is possessed by a Player
UnPossessWhen this Pawn is unpossessed by a Player

AnimationBeginNotify​

When an Animation Montage Notify begins
<AnyPawnClass>.Subscribe("AnimationBeginNotify", function(self, notify_name, animation_name, trigger_begin_time, trigger_end_time)
-- AnimationBeginNotify was called
end)

Arguments

TypeArgumentDescription
Base PawnselfThe Pawn that triggered the event
stringnotify_nameName of the Animation Notify
stringanimation_nameName of the Animation Montage that fired the notify
numbertrigger_begin_timeTime in the animation when the notify begins, in seconds
numbertrigger_end_timeTime in the animation when the notify ends, in seconds

AnimationEndNotify​

When an Animation Montage Notify ends
<AnyPawnClass>.Subscribe("AnimationEndNotify", function(self, notify_name, animation_name, trigger_begin_time, trigger_end_time)
-- AnimationEndNotify was called
end)

Arguments

TypeArgumentDescription
Base PawnselfThe Pawn that triggered the event
stringnotify_nameName of the Animation Notify
stringanimation_nameName of the Animation Montage that fired the notify
numbertrigger_begin_timeTime in the animation when the notify begins, in seconds
numbertrigger_end_timeTime in the animation when the notify ends, in seconds

MoveComplete​

Called when AI reaches its destination, or when it fails
<AnyPawnClass>.Subscribe("MoveComplete", function(self, succeeded)
-- MoveComplete was called
end)

Arguments

TypeArgumentDescription
Base PawnselfThe Pawn that triggered the event
booleansucceededWhether it reached the destination

See also StopMovement, MoveTo, Follow, GetMovingTo.


Possess​

When this Pawn is possessed by a Player
<AnyPawnClass>.Subscribe("Possess", function(self, player)
-- Possess was called
end)

Arguments

TypeArgumentDescription
Base PawnselfThe Pawn that triggered the event
PlayerplayerThe Player

See also UnPossess, GetPlayer.


UnPossess​

When this Pawn is unpossessed by a Player
<AnyPawnClass>.Subscribe("UnPossess", function(self, old_player)
-- UnPossess was called
end)

Arguments

TypeArgumentDescription
Base PawnselfThe Pawn that triggered the event
Playerold_playerThe Player that was possessing this Pawn

See also Possess, GetPlayer.