Skip to content

marble3 / PlayerInput

Interface: PlayerInput ​

Defined in: src/player/player.ts:147

A player's input source, read once a frame by Player.update(). DesktopController and MobileController implement it; assign your own to player.inputController to drive the player from anything else.

Properties ​

enabled ​

enabled: boolean

Defined in: src/player/player.ts:149

False while input is suspended, behind a dialog for instance.

Methods ​

direction() ​

direction(): Vector3

Defined in: src/player/player.ts:159

The direction to walk in, level with the ground. Any length: the player normalizes it.

Returns ​

Vector3


dispose() ​

dispose(): void

Defined in: src/player/player.ts:161

Removes listeners and on-screen controls.

Returns ​

void


isLocked() ​

isLocked(): boolean

Defined in: src/player/player.ts:151

Whether the player may move this frame. Desktop: the pointer is locked. Touch: enabled.

Returns ​

boolean


lock() ​

lock(): void

Defined in: src/player/player.ts:153

Asks to capture input. Desktop: requests pointer lock, which needs a user gesture. Touch: nothing to do.

Returns ​

void


update() ​

update(delta): void

Defined in: src/player/player.ts:155

Applies this frame's look input to the camera.

Parameters ​

delta ​

number

Returns ​

void


wantsJump() ​

wantsJump(): boolean

Defined in: src/player/player.ts:157

Whether a jump is asked for this frame.

Returns ​

boolean