CharacterController¶
Extends EngineObject.
A walking character: a capsule that slides along walls, climbs stairs and slopes, sticks to the ground going down and stands on moving platforms, without being a rigid body (Jolt's CharacterVirtual). Make one with PhysicsWorld.CreateCharacter; it moves in every fixed step toward DesiredVelocity, and its entity's transform (the feet) follows, blended between steps like a dynamic body's. Dynamic bodies are pushed by it and do not push it.
Properties¶
entity: EntityThe entity that follows the character. Read-only.desired_velocity: Vector3The velocity the character tries to have, in meters per second, in world space. Only the horizontal part matters: gravity and jumps decide the vertical one.is_on_ground: booleanWhether the character stands on something that holds it (not a slope too steep to stand on). Read-only.ground_velocity: Vector3The velocity of the ground under the character (a moving platform), or zero in the air. Read-only.velocity: Vector3How fast the character actually moved in the last step. Read-only.max_slope_degrees: numberThe steepest slope in degrees the character can stand and walk on. Read-only.position: Vector3Where the feet are, after the last step. Read-only.
Methods¶
jump¶
function jump(self, speed: number): ()
Starts a jump of this upward speed (m/s) at the next step, if the character is on the ground then.
teleport¶
function teleport(self, position: Vector3): ()
Puts the character (its feet) here at once; its entity follows with no blend.
set_rotation¶
function set_rotation(self, rotation: Quat): ()
Turns the character about its up axis (its entity follows).