Skip to content

Variable: TwoHandsGrabbable

const TwoHandsGrabbable: Component<{ rotate: { default: true; type: Boolean; }; rotateMax: { default: [number, number, number]; type: Vec3; }; rotateMin: { default: [number, number, number]; type: Vec3; }; scale: { default: true; type: Boolean; }; scaleMax: { default: [number, number, number]; type: Vec3; }; scaleMin: { default: [number, number, number]; type: Vec3; }; translate: { default: true; type: Boolean; }; translateMax: { default: [number, number, number]; type: Vec3; }; translateMin: { default: [number, number, number]; type: Vec3; }; }>

Defined in: packages/core/src/grab/two-hands-grabbable.ts:59

Component for enabling two‑handed object grabbing and manipulation.

Remarks

  • Enables advanced manipulation using both VR controllers or hand inputs simultaneously.
  • Supports rotation, translation, and scaling operations (scaling requires two hands).
  • Distance between hands controls scaling: spreading hands apart scales up, bringing them together scales down.
  • The position of first controller that grabbed the objects determines the object's position during translation.
  • Rotation is calculated from the relative orientation between the two hands.
  • All transformations can be independently enabled/disabled and constrained per axis.
  • Works with the GrabSystem to automatically create multitouch interaction handles.

Examples

ts
entity.addComponent(TwoHandsGrabbable, {})
ts
entity.addComponent(TwoHandsGrabbable, {
  rotate: false,
  translate: false,
  scale: true,
  scaleMin: [0.1, 0.1, 0.1],
  scaleMax: [5, 5, 5]
})
ts
entity.addComponent(TwoHandsGrabbable, {
  rotate: true,
  translate: true,
  scale: true,
  rotateMin: [-Math.PI/4, -Math.PI/2, -Math.PI/4],
  rotateMax: [Math.PI/4, Math.PI/2, Math.PI/4],
  translateMin: [-1, 0, -1],
  translateMax: [1, 2, 1],
  scaleMin: [0.5, 0.5, 0.5],
  scaleMax: [2, 2, 2]
})

See