Repository navigation
API Class PlayerInput
Defined in: src/engine/input/facade.ts:60
One player's input, as a script reads it. From a behavior (this.input) it reads the pawn the
behavior belongs to (the nearest node up its hierarchy with ControlledBy or an action set),
so it also works on a server, where pawns get their connection's actions; from InputPlayers
it reads the player's node.
get accessibility(): Readonly<InputAccessibility>;Defined in: src/engine/input/facade.ts:187
The player's accessibility settings (changes apply next frame).
Readonly<InputAccessibility>
set accessibility(value): void;Defined in: src/engine/input/facade.ts:191
void
get battery():
| {
charging: boolean;
level: number;
}
| null;Defined in: src/engine/input/facade.ts:296
The battery of the player's gamepads: level 0..1 and whether it's charging (plugged in),
for the paired gamepad with the lowest level when there are several. Null when none of them
reports a level: no gamepad, a wired pad without a battery, or an adapter that can't tell (the
browser's Gamepad API; desktop builds and WebHID pads in Chromium can).
| {
charging: boolean;
level: number;
}
| null
get devices(): GameObject[];Defined in: src/engine/input/facade.ts:229
The device nodes paired with this player.
get index(): number;Defined in: src/engine/input/facade.ts:72
The player's index, or -1 when no local player is behind it (a server pawn).
number
get lastFamily(): DeviceFamily;Defined in: src/engine/input/facade.ts:159
The family of the device this player last performed an action with (prompts follow it).
get player(): GameObject | null;Defined in: src/engine/input/facade.ts:77
The player's node (under the World's Input node), or null.
GameObject | null
canceled(action): boolean;Defined in: src/engine/input/facade.ts:136
string
boolean
completed(action): boolean;Defined in: src/engine/input/facade.ts:133
string
boolean
elapsed(action): number;Defined in: src/engine/input/facade.ts:107
Seconds the action has been actuated (hold progress, charge).
string
number
held(action): boolean;Defined in: src/engine/input/facade.ts:112
string
boolean
loadBindings(profile?): Promise<boolean>;Defined in: src/engine/input/facade.ts:220
Load what saveBindings saved (a format 1 file is upgraded); false if nothing was saved.
string
Promise<boolean>
on(
action,
phase,
fn
): () => void;Defined in: src/engine/input/facade.ts:147
Call fn when the action reaches phase, for this input's player or the node it reads:
dispatched from ActionEvents, in the input phase for local players, and in the fixed step
(before fixedUpdate scripts) for a pawn a network server writes a client's actions onto. From
a behavior, it's unsubscribed when the behavior is disabled; the returned function
unsubscribes sooner.
string
(e) => void
() => void
ongoing(action): boolean;Defined in: src/engine/input/facade.ts:124
string
boolean
pair(device): void;Defined in: src/engine/input/facade.ts:235
Pair a device node with this player (taking it from any other).
void
performed(action): boolean;Defined in: src/engine/input/facade.ts:130
string
boolean
pressed(action): boolean;Defined in: src/engine/input/facade.ts:115
string
boolean
prompt(action, family?): InputPrompt | null;Defined in: src/engine/input/facade.ts:164
What performs action, named for family (default: the family last used). Null if nothing does.
string
InputPrompt | null
rebind(action, options?): Promise<RebindResult>;Defined in: src/engine/input/facade.ts:173
Bind action to the player's next press (see RebindOptions): replace a control of its
mapping for the device group, or with add: true add a mapping for it.
string
Promise<RebindResult>
released(action): boolean;Defined in: src/engine/input/facade.ts:118
string
boolean
resetBindings(): void;Defined in: src/engine/input/facade.ts:204
Drop every binding change: replaced controls, added mappings and removed ones (back to the contexts' bindings).
void
rumble(
low,
high,
durationMs
): void;Defined in: src/engine/input/facade.ts:248
Rumble the player's gamepads: low and high motor strengths 0..1, for durationMs.
number
number
number
void
rumbleTriggers(
left,
right,
durationMs
): void;Defined in: src/engine/input/facade.ts:256
Rumble the triggers (DualSense and Xbox impulse triggers; where the device and platform can).
number
number
number
void
saveBindings(profile?): Promise<void>;Defined in: src/engine/input/facade.ts:212
Save the binding changes and accessibility with the game's settings, as
input.<profile>.json (default player<index>), in profile format 2.
string
Promise<void>
setLight(
r,
g,
b
): void;Defined in: src/engine/input/facade.ts:275
Set the light bar colour (0..255 each; DualSense and DualShock 4, on desktop and through WebHID in Chromium).
number
number
number
void
setSensors(enabled): void;Defined in: src/engine/input/facade.ts:283
Turn gyro and accelerometer reports on or off (desktop, and WebHID in Chromium; off by default, they cost battery).
boolean
void
setTriggerEffect(trigger, effect): void;Defined in: src/engine/input/facade.ts:267
Set an adaptive trigger effect: resistance, a weapon's click, vibration (DualSense, on
desktop and in Chromium browsers through WebHID). { mode: "off" } frees the trigger.
"left" | "right"
void
started(action): boolean;Defined in: src/engine/input/facade.ts:121
string
boolean
triggered(action): boolean;Defined in: src/engine/input/facade.ts:127
string
boolean
unbind(action, options): boolean;Defined in: src/engine/input/facade.ts:182
Remove the player's mapping of action for a device group (the first, by priority, unless
context says which): one the player added is deleted, one of the context's own is recorded
in the profile's removals (resetBindings brings it back). False when there was none.
string
boolean
unpair(device): void;Defined in: src/engine/input/facade.ts:242
Unpair a device node from this player.
void
value(action): number;Defined in: src/engine/input/facade.ts:87
A button's or axis's value; a vector's length. 0 when there's nothing to read.
string
number
vector2(action, out?): Vector2;Defined in: src/engine/input/facade.ts:95
A vec2 action's value (+Y up).
string
Vector2 = ...
vector3(action, out?): Vector3;Defined in: src/engine/input/facade.ts:100
string
Vector3 = ...
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference