Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / XrAttachPoint

Type Alias: XrAttachPoint ​

ts
type XrAttachPoint = {
  id: string;
  name: string;
  position: {
     x: number;
     y: number;
     z: number;
  };
  rotation: {
     x: number;
     y: number;
     z: number;
  };
  hand: "left" | "right" | "any";
  role: "primary" | "secondary" | "any";
};

Defined in: components/XRInteractable.ts:40

A hand-hold authored on the object.

Without attach points a hand grabs wherever it happens to touch, which is right for a ball and wrong for a rifle — a weapon has a grip and a foregrip, and the hands belong on those exact spots. role is what lets an author say "this is the trigger hand's hold" so a two-hand grab assembles correctly no matter which hand arrives first.

Properties ​

PropertyTypeDescriptionDefined in
idstringStable id; referenced by scripts and by the inspector list.components/XRInteractable.ts:42
namestring-components/XRInteractable.ts:43
position{ x: number; y: number; z: number; }Object-local position of the hold (unscaled).components/XRInteractable.ts:45
position.xnumber-components/XRInteractable.ts:45
position.ynumber-components/XRInteractable.ts:45
position.znumber-components/XRInteractable.ts:45
rotation{ x: number; y: number; z: number; }Object-local orientation of the hold, radians.components/XRInteractable.ts:47
rotation.xnumber-components/XRInteractable.ts:47
rotation.ynumber-components/XRInteractable.ts:47
rotation.znumber-components/XRInteractable.ts:47
hand"left" | "right" | "any"Restrict to one hand, or any.components/XRInteractable.ts:49
role"primary" | "secondary" | "any"Whether this hold is the anchoring hand, the steering hand, or either.components/XRInteractable.ts:51