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

Blueprint Spawn Character (Server)Scroll to zoom · Drag to pan · Drag nodes to move
Event BeginPlaySpawn Actor from ClassClassHCharacterSpawn TransformReturn Value

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

Blueprint Play Animation MontageScroll to zoom · Drag to pan · Drag nodes to move
Event BeginPlayPlay Anim MontageTargetCharacter RefMontage to PlayMy MontagePlay Rate1.0Start Section"StartSection"Return Value

Attaching Meshes

Blueprint Attach Static Mesh to CharacterScroll to zoom · Drag to pan · Drag nodes to move
Event BeginPlayAdd Static Mesh AttachedTargetCharacter RefID"bag"MeshBag MeshBone Name"spine_03"

Ragdoll Mode

Blueprint Toggle Ragdoll ModeScroll to zoom · Drag to pan · Drag nodes to move
Event BeginPlaySet Ragdoll ModeTargetCharacter RefEnabledtrueIs In Ragdoll ModeTargetCharacter RefReturn Value

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()).