GrabSystem turns grab components into interaction handles and coordinates them with the pointer stack.| Component | Interaction | Scale support |
|---|---|---|
OneHandGrabbable | Direct manipulation with one input | No |
TwoHandsGrabbable | Direct manipulation with two inputs | Yes |
DistanceGrabbable | Ray-based remote manipulation | Depends on its configuration |
import {
OneHandGrabbable,
RayInteractable,
SessionMode,
World,
} from '@iwsdk/core';
const world = await World.create(document.getElementById('scene')!, {
xr: { sessionMode: SessionMode.ImmersiveVR },
features: { grabbing: true },
});
const entity = world.createTransformEntity(mesh);
entity.addComponent(RayInteractable);
entity.addComponent(OneHandGrabbable, {
rotate: true,
translate: true,
rotateMin: [-Math.PI / 4, -Math.PI, -Math.PI / 4],
rotateMax: [Math.PI / 4, Math.PI, Math.PI / 4],
});
RayInteractable makes the entity available to the ray interaction path. Use this tag for new ray-selectable entities.Entity gains a grab component
↓
GrabSystem creates and configures a handle
↓
Pointer events start, update, and end manipulation
↓
Entity loses the component
↓
GrabSystem cancels and removes the handle