Skip to main content

Character (HCharacter)

The HCharacter class extends Actor and 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

// Characters are spawned via Lua scripting on the server.

Constructor Parameters

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.

Methods

MethodParametersReturn TypeAuthorityDescription
PlayAnimationMontage: AnimMontage, PlayRate: number, StartSection: stringvoidBothPlays a montage animation on the character.
StopAnimationBlendOut: number, Montage: AnimMontagevoidBothStops an active montage with an optional blend-out time.
AddStaticMeshAttachedID: string, Mesh: StaticMesh, BoneName: stringvoidBothAttaches a static mesh to a bone/socket on the character.
RemoveStaticMeshAttachedID: stringvoidBothRemoves a previously attached mesh by ID.
RemoveAllStaticMeshesAttached--voidBothRemoves all attached meshes from the character.
SetInputEnabledbEnabled: booleanvoidServerEnables or disables player input for movement and look.
SetRagdollModebEnabled: booleanvoidBothToggles ragdoll physics on or off.
SetMeshMesh: SkeletalMeshvoidBothOverrides the character's skeletal mesh.
GetPawn--ACharacterBothReturns the underlying ACharacter actor.
GetPlayer--APlayerControllerBothReturns the controlling APlayerController.
GetTeam--numberBothReturns the team value assigned to the character.
GetMesh--stringBothReturns the name of the currently assigned skeletal mesh.
GetBoneTransformBoneName: stringFTransformBothReturns a FTransform for a bone name (e.g., "hand_r").
IsInRagdollMode--booleanBothReturns true if ragdoll physics are currently active.
IsInputEnabled--booleanBothReturns whether input is currently enabled.

Examples

Playing an Animation

// Play an animation montage on the character via Lua scripting.

Attaching Meshes

// Mesh attachment is handled via Lua scripting.

Ragdoll Mode

// Ragdoll mode is toggled via Lua scripting.

note

Player characters are spawned by passing the player controller to the HCharacter constructor. The player controller then possesses the character's pawn via player:Possess(char:GetPawn()).