Schemas / I/O

rig.input.binding

v1.0.0 · stable maturity: draft 6 fields 3 required

Fields

FieldTypeMeaning
player int optional Optional. Player index (0-based); absent = 0
control string required Logical control or action name
device enumkey · mouse · pad · touch · vr required key, mouse, pad, touch, vr
index int optional Optional. Device index; absent = 0
code string required Name of the control on that device (a, space, left, button-0, axis-0, primary)
deadzone number0 – 1 optional Optional. 0-1 axis deadzone; absent = the host default

One device control mapped onto a logical input. Format when present.

The logical fields live on rig.input.buttons, rig.input.axes, and rig.input.pointer for the same player. This component only names the source.

Well-known control tokens, for the fields on buttons, axes, and pointer: left, right, up, down, o, x, move-x, move-y, look-x, look-y, left-trigger, right-trigger, left-grip, right-grip, pointer-x, pointer-y, primary, secondary. Any other string is a named action the host implements (jump). An unknown action is skipped.

code is a token the host understands for device. An unknown code is skipped. Several bindings may drive one control; the host ORs buttons and takes the latest axis.

For device vr, index 0 is the left controller and 1 is the right controller of that player. Well-known codes: trigger, squeeze, thumbstick-x, thumbstick-y, thumbstick-click, trackpad-x, trackpad-y, trackpad-touch, menu, system, a, b, x, y. The controller entity is rig.vr.controller - docs/vr.md.

JSON Schema

Resolves at https://rig.works/schemas/rig.input.binding.schema.json — raw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.input.binding.schema.json",
  "title": "rig.input.binding",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "player": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "control": {
      "$ref": "./_defs.schema.json#/$defs/string"
    },
    "device": {
      "type": "string",
      "enum": [
        "key",
        "mouse",
        "pad",
        "touch",
        "vr"
      ]
    },
    "index": {
      "$ref": "./_defs.schema.json#/$defs/int"
    },
    "code": {
      "$ref": "./_defs.schema.json#/$defs/string"
    },
    "deadzone": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    }
  },
  "required": [
    "control",
    "device",
    "code"
  ],
  "x-rig-maturity": "draft"
}

Seen in

play-scene.json · vr-room.json