Verge3D PzLib API — XR

# XR

#### xrGetInputSource(controller) → (nullable) {XRInputSource}

Get the XR input source for the given controller.

##### Parameters:

Name | Type | Description
--- | --- | ---
`controller` | v3d.Group | A group representing an XR controller (specifically the target ray space of the controller). Can be obtained by calling WebXRManager's getController() method (WebXRManager can be accessed through app's renderer.xr property).

##### Returns:

The XR input source or null if not available.

Type
  XRInputSource

#### xrGetIntersections(controller) → {Array.<Object>}

Get intersections between the given XR controller's target ray and objects in the current scene (excluding XR controller objects).

##### Parameters:

Name | Type | Description
--- | --- | ---
`controller` | v3d.Group | A group representing an XR controller (specifically the target ray space of the controller). Can be obtained by calling WebXRManager's getController() method (WebXRManager can be accessed through app's renderer.xr property).

##### Returns:

The array containing intersection data for the ray casted from the XR controller. Has the same format as the result of the v3d.Raycaster's intersectObjects() method.

Type
  Array.<Object>

#### xrOnSelect(event)

An event handler for the "select" XRInputSourceEvent. Binds object picking functionality to the XR controller's primary action.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | Object | An event dispatched to the XR controller object.

See:
  - Primary action

#### xrTraverseNonControllers(obj, callback)

Traverse the given object and its descendants except the ones that represent XR controllers, then execute the given callback for non-controller objects.

##### Parameters:

Name | Type | Description
--- | --- | ---
`obj` | Object3D | The object.
`callback` | function | The function to be called for each non-controller Object3D during the traverse and receives that object as a parameter. It's similar to the callback parameter in Object3D's traverse() method.