Class KinematicCharacterController

A character controller for controlling kinematic bodies and parentless colliders by hitting and sliding against obstacles.

Hierarchy

  • KinematicCharacterController

Constructors

Properties

_applyImpulsesToDynamicBodies: any
_characterMass: any
bodies: any
colliders: any
params: any
queries: any
raw: any
rawCharacterCollision: any

Methods

  • Returns boolean

  • Is automatically stepping over small objects enabled?

    Returns boolean

  • Can the character automatically step over dynamic bodies too?

    Returns boolean

  • The maximum step height a character can automatically step over.

    Returns number

  • The minimum width of free space that must be available after stepping on a stair.

    Returns number

  • Returns the custom value of the character mass, if it was set by this.setCharacterMass.

    Returns number

  • Computes the movement the given collider is able to execute after hitting and sliding on obstacles.

    Parameters

    • collider: Collider

      The collider to move.

    • desiredTranslationDelta: Vector

      The desired collider movement.

    • Optional filterFlags: QueryFilterFlags

      Flags for excluding whole subsets of colliders from the obstacles taken into account.

    • Optional filterGroups: number

      Groups for excluding colliders with incompatible collision groups from the obstacles taken into account.

    • Optional filterPredicate: ((collider: Collider) => boolean)

      Any collider for which this closure returns false will be excluded from the obstacles taken into account.

    Returns void

  • Returns the collision against one of the obstacles detected along the path of the last call to this.computeColliderMovement.

    Parameters

    • i: number

      The i-th collision will be returned.

    • Optional out: CharacterCollision

      If this argument is set, it will be filled with the collision information.

    Returns CharacterCollision

  • The result of ground detection computed by the last call to this.computeColliderMovement.

    Returns boolean

  • The movement computed by the last call to this.computeColliderMovement.

    Returns Vector

  • Disable automatically stepping over small objects.

    Returns void

  • Disables automatically snapping the character to the ground.

    Returns void

  • Enabled automatically stepping over small objects.

    Parameters

    • maxHeight: number

      The maximum step height a character can automatically step over.

    • minWidth: number

      The minimum width of free space that must be available after stepping on a stair.

    • includeDynamicBodies: boolean

      Can the character automatically step over dynamic bodies too?

    Returns void

  • Enables automatically snapping the character to the ground if the distance between the ground and its feet are smaller than the specified threshold.

    Parameters

    • distance: number

    Returns void

  • Internal

    Returns void

  • The maximum angle (radians) between the floor’s normal and the up vector that the character is able to climb.

    Returns number

  • The minimum angle (radians) between the floor’s normal and the up vector before the character starts to slide down automatically.

    Returns number

  • The number of collisions against obstacles detected along the path of the last call to this.computeColliderMovement.

    Returns number

  • A small gap to preserve between the character and its surroundings.

    This value should not be too large to avoid visual artifacts, but shouldn’t be too small (must not be zero) to improve numerical stability of the character controller.

    Returns number

  • Parameters

    • enabled: boolean

    Returns void

  • Set the mass of the character to be used for impulse resolution if self.applyImpulsesToDynamicBodies is set to true.

    If no character mass is set explicitly (or if it is set to null) it is automatically assumed to be equal to the mass of the rigid-body the character collider is attached to; or equal to 0 if the character collider isn’t attached to any rigid-body.

    Parameters

    • mass: number

      The mass to set.

    Returns void

  • Sets the maximum angle (radians) between the floor’s normal and the up vector that the character is able to climb.

    Parameters

    • angle: number

    Returns void

  • Sets the minimum angle (radians) between the floor’s normal and the up vector before the character starts to slide down automatically.

    Parameters

    • angle: number

    Returns void

  • Sets a small gap to preserve between the character and its surroundings.

    This value should not be too large to avoid visual artifacts, but shouldn’t be too small (must not be zero) to improve numerical stability of the character controller.

    Parameters

    • value: number

    Returns void

  • Enable or disable sliding against obstacles.

    Parameters

    • enabled: boolean

    Returns void

  • Sets the direction that goes "up". Used to determine where the floor is, and the floor’s angle.

    Parameters

    Returns void

  • Is sliding against obstacles enabled?

    Returns boolean

  • If snap-to-ground is enabled, should the character be automatically snapped to the ground if the distance between the ground and its feet are smaller than the specified threshold?

    Returns number

  • Is automatically snapping the character to the ground enabled?

    Returns boolean

  • The direction that goes "up". Used to determine where the floor is, and the floor’s angle.

    Returns Vector

Generated using TypeDoc