Skip to content

Vector2Input

An XY number pair. The inspector renders two side-by-side number inputs labelled X and Y.

Runtime value: { x: number; y: number }

Vector2Input inspector control

Declaration

ts
import { Behaviour, type Vector2Input } from "@relu-interactives/spatial-ecs";

export default class Demo extends Behaviour {
  data = {
    offset:   { x: 0, y: 0 } as Vector2Input,
    uvScale:  { x: 1, y: 1 } as Vector2Input,
  };
}

Runtime usage

Read x and y directly:

ts
onUpdate() {
  this.transform.position.x += this.data.offset.x * this.deltaTime;
  this.transform.position.y += this.data.offset.y * this.deltaTime;
}

Notes

  • Suitable for screen-space positions, UV offsets, or any 2D vector parameter.
  • Use Vector3Input for 3D world-space values.