Repository navigation
API Class PlayerInput
Defined in: src/engine/input/facade.ts:61
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:188
The player's accessibility settings (changes apply next frame).
Readonly<InputAccessibility>
set accessibility(value): void;Defined in: src/engine/input/facade.ts:192
void
get battery():
| {
charging: boolean;
level: number;
}
| null;Defined in: src/engine/input/facade.ts:334
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:267
The device nodes paired with this player.
get index(): number;Defined in: src/engine/input/facade.ts:73
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:160
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:78
The player's node (under the World's Input node), or null.
GameObject | null
canceled(action): boolean;Defined in: src/engine/input/facade.ts:137
string
boolean
completed(action): boolean;Defined in: src/engine/input/facade.ts:134
string
boolean
elapsed(action): number;Defined in: src/engine/input/facade.ts:108
Seconds the action has been actuated (hold progress, charge).
string
number
hasBindingChanges(action?): boolean;Defined in: src/engine/input/facade.ts:223
Whether the player has binding changes resetBindings would drop: replaced controls, added mappings or removed
ones. With action (bare or "set.Id:action"), only that action's, so a per-action Reset can be disabled when
there's nothing to reset (ADR 0661). Throws for an action no set has, as resetBindings does.
string
boolean
held(action): boolean;Defined in: src/engine/input/facade.ts:113
string
boolean
loadBindings(profile?): Promise<boolean>;Defined in: src/engine/input/facade.ts:256
Load what saveBindings saved (a format 1 file is upgraded); false if nothing was saved, or the file is from a
newer Myco (refused with a warning, the bindings unchanged).
string
Promise<boolean>
on(
action,
phase,
fn
): () => void;Defined in: src/engine/input/facade.ts:148
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:125
string
boolean
pair(device): void;Defined in: src/engine/input/facade.ts:273
Pair a device node with this player (taking it from any other).
void
performed(action): boolean;Defined in: src/engine/input/facade.ts:131
string
boolean
pressed(action): boolean;Defined in: src/engine/input/facade.ts:116
string
boolean
prompt(action, family?): InputPrompt | null;Defined in: src/engine/input/facade.ts:165
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:174
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:119
string
boolean
resetBindings(action?): boolean;Defined in: src/engine/input/facade.ts:205
Drop the player's binding changes: replaced controls, added mappings and removed ones (back to the contexts'
bindings). With action (bare or "set.Id:action"), only that action's, in every context and for every device
(ADR 0656). False when there was nothing to drop for the action.
string
boolean
rumble(
low,
high,
durationMs
): void;Defined in: src/engine/input/facade.ts:286
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:294
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:245
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:313
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:321
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:305
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:122
string
boolean
triggered(action): boolean;Defined in: src/engine/input/facade.ts:128
string
boolean
unbind(action, options): boolean;Defined in: src/engine/input/facade.ts:183
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:280
Unpair a device node from this player.
void
value(action): number;Defined in: src/engine/input/facade.ts:88
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:96
A vec2 action's value (+Y up).
string
Vector2 = ...
vector3(action, out?): Vector3;Defined in: src/engine/input/facade.ts:101
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