Skip to main content

HCharacter

HCharacter spawns a customizable player character into the world with support for animation, mesh overrides, ragdoll physics, and attachments. It is designed for gameplay characters that need full control over visuals, input, skeletal sockets, and interactions. This class is ideal for roleplay systems, test bots, or any scenario where you need a fully controllable humanoid character

/// tip HCharacter is an Actor so it inherits all functions from Actor ///

Constructorโ€‹

Example
local char = HCharacter(Vector(0,0,100), Quat(0,0,0,1), player)
player:Possess(char:GetPawn())
NameTypeDefaultDescription
locationVector(0,100,100)Spawn position
rotationQuat(0,0,0,1)Spawn orientation
playerAPlayerControllerRequiredPlayer controller to possess the character
collision_typestring"Pawn"Collision profile
gravity_enabledbooleantrueWhether gravity is applied to the pawn
max_healthnumber100Character's starting health
death_soundSoundCuenilOptional death sound
pain_soundSoundCuenilOptional hurt sound

Functionsโ€‹

PlayAnimationโ€‹

Plays a montage animation on the character.

char:PlayAnimation(MyMontage, 1.0, "StartSection")

StopAnimationโ€‹

Stops an active montage with an optional blend-out.

char:StopAnimation(0.25, MyMontage)

AddStaticMeshAttachedโ€‹

Attaches a static mesh to a bone/socket on the character.

char:AddStaticMeshAttached("bag", BagMesh, "spine_03")

RemoveStaticMeshAttachedโ€‹

Removes a previously attached mesh by ID.

char:RemoveStaticMeshAttached("bag")

RemoveAllStaticMeshesAttachedโ€‹

Removes all attached meshes from the character.

char:RemoveAllStaticMeshesAttached()

SetInputEnabledโ€‹

Enables or disables player input for movement and look.

char:SetInputEnabled(false)

SetRagdollModeโ€‹

Toggles ragdoll physics on or off.

char:SetRagdollMode(true)

SetMeshโ€‹

Overrides the characterโ€™s skeletal mesh.

char:SetMesh(UE.UObject.Load("/Game/MyMeshes/MyCustomMesh.MyCustomMesh"))

GetPawnโ€‹

Returns the underlying ACharacter actor.

local pawn = char:GetPawn()

GetPlayerโ€‹

Returns the controlling APlayerController.

local pc = char:GetPlayer()

GetTeamโ€‹

Returns the team value assigned to the character.

local t = char:GetTeam()

GetMeshโ€‹

Returns the name of the currently assigned skeletal mesh.

print(char:GetMesh())

GetBoneTransformโ€‹

Returns a FTransform for a bone name (e.g., "hand_r").

local transform = char:GetBoneTransform("spine_03")

IsInRagdollModeโ€‹

Returns true if ragdoll physics are currently active.

if char:IsInRagdollMode() then ...

IsInputEnabledโ€‹

Returns whether input is currently enabled.

print(char:IsInputEnabled())
โœจ