TruWorlds

CharacterController

Inherits: Model

CharacterController is a special type of Model that provides standard platformer movement mechanics.

A CharacterController is automatically created for each Player in the game. When a player's CharacterController dies, a new one is automatically created at an active respawn location.

Properties

FlyEnabled bool

Whether the character can fly. If true, the character can move freely in 3D space without being affected by gravity.

FlySpeedMultiplier float

The speed multiplier applied to movement while flying. This allows flying movement to be faster or slower than normal movement.

Health int
JumpForce float

The jump force of the character, measured as the initial upward velocity when jumping, in studs per second.

JumpHeight float

The maximum jump height the character can reach, in studs.

LoadCharacterAppearance bool

Whether the player's character appearance should be loaded when spawning.

MaxHealth int
MaxSlopeAngle float

The maximum slope angle the character can walk up, in degrees.

MoveSpeed float

The movement speed of the character, in studs per second.

MoveVelocity Vector3

The current movement velocity of the character.

RollAfterTrip bool

Whether the character can roll while in the tripping state.

RunSpeed float

The running speed of the character, in studs per second.

The current state of the character controller.

StepHeight float

The maximum height moving up steps without needing to jump, in studs.

TiltBasedThreshold float

The tilt angle (in degrees) used for TiltBased tripping.

Determines how the character can automatically enter the tripping state.

UsePlayerInput bool

Whether this character should read player input (local authority only).

Functions

ComputePath(destination: Vector3) Returns DynValue
Damage(amount: int)
HybridPathTo(destination: Vector3)
IsMoveToFinished() Returns bool
Jump()
Kill()
MoveStop()
MoveTo(target: Vector3)
PathStop()
PathTo(destination: Vector3)
Run()

Forces non-player controlled characters to use running speed while moving.

Sit()

Makes the character sit on the ground. Unlike Seated, the character is not anchored to any object and has the same free physics behavior as Tripping — they can be pushed around. The player can stand back up by pressing Jump or by calling StandUp.

StandUp()

Stands the character back up from CharacterControllerState.Sitting. Has no effect in other states.

Trip()
Walk()

Forces non-player controlled characters to use walking speed while moving.

Signals

Damaged

Event fired when the character receives damage

Died

Event fired when the character dies.

MoveToFinished bool

Event fired when a MoveTo request completes.

PathBlocked bool

Event fired when a PathTo request cannot find a valid path.

PathCompleted bool

Event fired when a PathTo request reaches its destination.

PathToFinished bool

Event fired when a PathTo request finishes (true if reached, false if blocked).