Skip to content

@relu-interactives/spatial-ecs


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

Class: XRInteractableComponent ​

Defined in: components/XRInteractable.ts:123

Makes an entity respond to XR pointers and hands.

Split into pointable and grabbable because they are different affordances: a wall panel should receive select events without being liftable, while a physics prop should be both.

Extends ​

Constructors ​

Constructor ​

ts
new XRInteractableComponent(options?): XRInteractableComponent;

Defined in: components/XRInteractable.ts:168

Parameters ​

ParameterType
options?XRInteractableOptions

Returns ​

XRInteractableComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDescriptionDefined in
enabledboolean-components/XRInteractable.ts:124
grabbableboolean-components/XRInteractable.ts:125
pointableboolean-components/XRInteractable.ts:126
grabReachXrGrabReachWhether the object can be grabbed up close, at range, or either.components/XRInteractable.ts:128
distanceBehaviorXrDistanceGrabBehaviorWhat a distance grab does — bring it here, or manipulate it in place.components/XRInteractable.ts:130
grabGestureXrGrabGestureWhich gesture grabs it.components/XRInteractable.ts:132
grabRadiusnumberMetres within which a physical grab registers.components/XRInteractable.ts:134
grabOffsetPosition{ x: number; y: number; z: number; }Position offset from the hand while held.components/XRInteractable.ts:136
grabOffsetPosition.xnumber-components/XRInteractable.ts:136
grabOffsetPosition.ynumber-components/XRInteractable.ts:136
grabOffsetPosition.znumber-components/XRInteractable.ts:136
grabOffsetRotation{ x: number; y: number; z: number; }Rotation offset (radians) while held.components/XRInteractable.ts:138
grabOffsetRotation.xnumber-components/XRInteractable.ts:138
grabOffsetRotation.ynumber-components/XRInteractable.ts:138
grabOffsetRotation.znumber-components/XRInteractable.ts:138
grabHandsXrGrabHandsHow many hands may hold it, and whether a second grab transfers it.components/XRInteractable.ts:140
twoHandRotationXrTwoHandRotationWhether the second hand aims the object or only scales it.components/XRInteractable.ts:142
allowTwoHandScalebooleanWhether a two-hand grab may resize the object.components/XRInteractable.ts:144
minScalenumberScale floor for one gesture, as a fraction of the size at grab time.components/XRInteractable.ts:146
maxScalenumberScale ceiling for one gesture, as a multiple of the size at grab time.components/XRInteractable.ts:148
attachPointsXrAttachPoint[]Authored hand-holds; empty means grab anywhere.components/XRInteractable.ts:150
applyVelocityOnReleasebooleanHand the object the velocity it was moving with when released. Applies to every release, not just a deliberate throw — letting go while your hand drifts should nudge the object, which is why this is not called "throw".components/XRInteractable.ts:158
velocityScalenumberMultiplier on released velocity.components/XRInteractable.ts:160
hoverBehaviorXrHoverBehaviorFeedback shown while a pointer is on the object.components/XRInteractable.ts:162
hoverColorstringOutline colour for the color and both behaviours.components/XRInteractable.ts:164
hoverScalenumberSize multiplier for the scale and both behaviours.components/XRInteractable.ts:166