Capítulo 583 de 859

Chapter 583: OculusHandPointerModel

Core Idea

Represents an Oculus hand pointer model.

Key Concepts

  • attached : boolean: Whether the model is attached or not.
  • controller : Group: The WebXR controller in target ray space.
  • cursorObject : Mesh: The cursor object.
  • hand : Group: The hand controller.
  • pinched : boolean: Whether the model is pinched or not.
  • pointerGeometry : BufferGeometry: The pointer geometry.
  • pointerMesh : Mesh: The pointer mesh.
  • pointerObject : Object3D: The pointer object that holds the pointer mesh.
  • raycaster : Raycaster: The internal raycaster used for detecting intersections.

Code Examples

import { OculusHandPointerModel } from 'three/addons/webxr/OculusHandPointerModel.js';
  • What it demonstrates: Typical usage of OculusHandPointerModel.

Reference Tables

Constructor

Signature
new OculusHandPointerModel( hand : Group, controller : Group )

Properties

PropertyDescription
.attached : booleanWhether the model is attached or not.
.controller : GroupThe WebXR controller in target ray space.
.cursorObject : MeshThe cursor object.
.hand : GroupThe hand controller.
.pinched : booleanWhether the model is pinched or not.
.pointerGeometry : BufferGeometryThe pointer geometry.
.pointerMesh : MeshThe pointer mesh.
.pointerObject : Object3DThe pointer object that holds the pointer mesh.
.raycaster : RaycasterThe internal raycaster used for detecting intersections.

Methods

MethodDescription
.checkIntersections( objects : Array.<Object3D>, recursive : boolean )Checks for intersections between the model's raycaster and the given objects. The method updates the cursor object to the intersection point.
.createPointer()Creates a pointer mesh and adds it to this model.
.dispose()Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
.intersectObject( object : Object3D, recursive : boolean ) : Array.<Raycaster~Intersection>Performs an intersection test with the model's raycaster and the given object.
.intersectObjects( objects : Array.<Object3D>, recursive : boolean ) : Array.<Raycaster~Intersection>Performs an intersection test with the model's raycaster and the given objects.
.isAttached() : booleanReturns true is the model is attached.
.isPinched() : booleanReturns true is the model is pinched.
.setAttached( attached : boolean )Sets the attached state.
.setCursor( distance : number )Sets the cursor to the given distance.
.updateMatrixWorld( force : boolean )Overwritten with a custom implementation. Makes sure the internal pointer and raycaster are updated.

Key Takeaways

  1. OculusHandPointerModel extends: EventDispatcher → Object3D
  2. Most relevant properties: attached, controller, cursorObject, hand.
  3. Key methods: checkIntersections, createPointer, dispose, intersectObject.

Connects To