iwsdk.config.json:{
"world": {
"xr": {
"mode": "vr",
"features": {
"handTracking": true
}
},
"input": {
"canvasPointerEvents": true
},
"features": {
"grabbing": true,
"locomotion": true
}
}
}
RayInteractable for ray or browser-pointer input:import {
BoxGeometry,
Mesh,
MeshStandardMaterial,
RayInteractable,
} from '@iwsdk/core';
const cube = new Mesh(
new BoxGeometry(0.4, 0.4, 0.4),
new MeshStandardMaterial({ color: 0x3355ff }),
);
world.createTransformEntity(cube).addComponent(RayInteractable);
InputSystem adds the transient Hovered and Pressed tags as pointer state changes. Query those tags from an application system.PokeInteractable for near touch or poke input.OneHandGrabbable: Moves or rotates an object with one grip.TwoHandsGrabbable: Supports two-handed manipulation.DistanceGrabbable: Moves, rotates, or scales an object from a distance.import {
DistanceGrabbable,
MovementMode,
RayInteractable,
} from '@iwsdk/core';
world
.createTransformEntity(mesh)
.addComponent(RayInteractable)
.addComponent(DistanceGrabbable, {
movementMode: MovementMode.MoveFromTarget,
});
iwsdk.config.json:{
"$schema": "./node_modules/@iwsdk/core/dist/schemas/iwsdk-project.v1.schema.json",
"version": "iwsdk.project.v1",
"scene": "./public/scenes/main.iwsdk.scene.json",
"world": {
"xr": {
"mode": "vr",
"features": {
"handTracking": { "required": true },
"gazeTracking": true
}
}
}
}
gazeTracking: true requests gaze tracking as an optional session feature. Use
gazeTracking: { "required": true } only when the immersive session must fail
if the feature is unavailable. If the feature is optional and the runtime does
not provide a usable gaze pose, IWSDK falls back to a ray that follows the head
pose.eyeTracking key is an alias for gazeTracking. Use
gazeTracking in new projects.RayInteractable targets. It emits the ordinary ray-pointer
lifecycle and drives the same Hovered and Pressed ECS tags as hand rays, so
no gaze-specific component or event handler is required.import { RayInteractable } from '@iwsdk/core';
target.addComponent(RayInteractable);
DistanceGrabbable is also a gaze target. Looking at
the object and pinching starts a distance grab. By default, the captured pointer
then follows the pinching hand until the pinch is released.world.features.gaze object overrides gaze behavior; it does not enable
gaze by itself. world.xr.features.gazeTracking is still required.| Field | Default | Behavior |
|---|---|---|
suppressWhenHandPointerActive | true | Yield while a hand pointer is active. |
filterMinCutoff | 1.5 | Set the minimum cutoff for gaze smoothing. |
filterBeta | 0.05 | Reduce smoothing during faster eye movement. |
dwellWindowSeconds | 0.15 | Set the target-consensus window in seconds. Set 0 to use each frame’s winner. |
coneAngle | 5 | Set the selection-cone half-angle in degrees. |
maxRayLength | 30 | Set the maximum target distance in meters. |
pointerTransformFollowsHand | true | Make a captured interaction follow the pinching hand’s ray. |
logDiagnostics | true | Log gaze-source diagnostics and show the fallback reticle state. |
LocomotionEnvironment:import {
EnvironmentType,
LocomotionEnvironment,
} from '@iwsdk/core';
world
.createTransformEntity(environmentMesh)
.addComponent(LocomotionEnvironment, {
type: EnvironmentType.STATIC,
});
{
"world": {
"xr": false,
"features": {
"locomotion": {
"browserControls": true
}
}
}
}
RayInteractable and confirm that the object’s mesh can be raycast. Also confirm that input is enabled for the selected runtime mode.LocomotionEnvironment to the walkable geometry. Use EnvironmentType.STATIC for fixed surfaces.