HCharacter
Tip
HCharacter is an Actor so it inherits all functions from Actor
Constructor#
local char = HCharacter(Vector(0,0,100), Quat(0,0,0,1), player)
player:Possess(char:GetPawn())
| Name | Type | Default | Description |
|---|---|---|---|
location |
Vector |
(0,100,100) |
Spawn position |
rotation |
Quat |
(0,0,0,1) |
Spawn orientation |
player |
APlayerController |
Required | Player controller to possess the character |
collision_type |
string |
"Pawn" |
Collision profile |
gravity_enabled |
boolean |
true |
Whether gravity is applied to the pawn |
max_health |
number |
100 |
Character's starting health |
death_sound |
SoundCue |
nil |
Optional death sound |
pain_sound |
SoundCue |
nil |
Optional 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())