Capítulo 858 de 859
For controller-less VR (like Google Cardboard-style headsets), the standard interaction is "look to select": raycast from the screen center (where the camera itself is aimed) and require the user to hold their gaze on an object for a short duration, visualized with a filling gauge, before it counts as selected.
(0, 0) to the same Raycaster-based PickHelper used for mouse picking.DataTexture with two colors, applied to a shape (e.g. TorusGeometry) with NearestFilter and ClampToEdge wrapping, can visually represent "progress" by animating the texture's offset over time (via MathUtils.mapLinear) so the boundary between the two colors sweeps across the shape.class PickHelper {
constructor() {
this.raycaster = new THREE.Raycaster();
}
pick(normalizedPosition, scene, camera, time) {
this.raycaster.setFromCamera(normalizedPosition, camera);
const hits = this.raycaster.intersectObjects(scene.children);
// ...flash/track the first hit, compare to previous frame's hit to build dwell time...
}
}
// gaze-based picking always uses the screen center:
pickHelper.pick({ x: 0, y: 0 }, scene, camera, time);
PickHelper for gaze-based VR selection simply by always passing the center of the screen as the pick position.DataTexture with an animated offset is a lightweight way to render a progress gauge without a custom shader.PickHelper pattern this lesson adapts for gaze-based VR selection.