Simpler character controller for smooth locomotin.

It needs to have a physx component attached to it. And be on the root of the player hierarchy.

See

PlayerControllerInput for handling input from various input providers

Hierarchy

  • Component
    • PlayerController

Properties

Input to feed the controller.

Using a non-component input is valid, e.g.,

import {PlayerControllerInput} fromn '@wonderlandengine/interaction';

class Input implements PlayerControllerInput {
getRotationAxis(out: vec3) {
out[0] = 1.0;
}
}

controller.input = new Input();
inputObject: null | Object3D = null

Object containing the PlayerControllerInput to read inputs from.

Note

If not provided, this component will create a default one.

rotationSpeed: number = 1

Rotation speed multiplier.

Note

Only used when transformType is RotationType.Smooth.

snapDegrees: number = 45

The number of degrees at which the player rotates when snap-rotating

trackedSpace: Object3D

Tracked space onto which the rotation is applied

transformType: RotationType = RotationType.Snap
walkSpeed: number = 1

Walk speed multiplier.

TypeName: string = 'player-controller'

Methods