Skip to main content

XR8.HandController.pipelineModule()

XR8.HandController.pipelineModule()

Description

Creates a camera pipeline module that, when installed, receives callbacks on when the camera has started, camera proessing events, and other state changes. These are used to calculate the camera's position.

Parameters

None

Returns

Return value is an object made available to onUpdate as:

processCpuResult.handcontroller: { rotation, position, intrinsics, cameraFeedTexture }

PropertyTypeDescription
rotation{w, x, y, z}The orientation (quaternion) of the camera in the scene.
position{x, y, z}The position of the camera in the scene.
intrinsics[Number]A 16 dimensional column-major 4x4 projection matrix that gives the scene camera the same field of view as the rendered camera feed.
cameraFeedTextureWebGLTextureThe texture containing camera feed data.

Dispatched Events

handloading: Fires when loading begins for additional hand AR resources.

handloading.detail : {maxDetections, pointsPerDetection, rightIndices, leftIndices}

PropertyTypeDescription
maxDetectionsNumberThe maximum number of hands that can be simultaneously processed.
pointsPerDetectionNumberNumber of vertices that will be extracted per hand.
rightIndices[{a, b, c}]Indexes into the vertices array that form the triangles of the hand mesh.
leftIndices[{a, b, c}]Indexes into the vertices array that form the triangles of the hand mesh.

handscanning: Fires when all hand AR resources have been loaded and scanning has begun.

handscanning.detail : {maxDetections, pointsPerDetection, rightIndices, leftIndices}

PropertyTypeDescription
maxDetectionsNumberThe maximum number of hands that can be simultaneously processed.
pointsPerDetectionNumberNumber of vertices that will be extracted per hand.
rightIndices[{a, b, c}]Indexes into the vertices array that form the triangles of the hand mesh.
leftIndices[{a, b, c}]Indexes into the vertices array that form the triangles of the hand mesh.

handfound: Fires when a hand is first found.

handfound.detail : {id, transform, vertices, normals, attachmentPoints}

PropertyTypeDescription
idNumberA numerical id of the located hand.
transform{position, rotation, scale}Transform information of the located hand.
vertices[{x, y, z}]Position of hand points, relative to transform.
normals[{x, y, z}]Normal direction of vertices, relative to transform.
handKindNumberA numerical representation of the handedness of the located hand. Valid values are 0 (unspecified), 1 (left), and 2 (right).
attachmentPoints{name, position: {x,y,z}}See XR8.HandController.AttachmentPoints for list of available attachment points. position is relative to the transform.

transform is an object with the following properties:

PropertyTypeDescription
position{x, y, z}The 3d position of the located hand.
rotation{w, x, y, z}The 3d local orientation of the located hand.
scaleNumberA scale factor that should be applied to objects attached to this hand.

attachmentPoints is an object with the following properties:

PropertyTypeDescription
nameStringThe name of the attachment point. See XR8.HandController.AttachmentPoints for list of available attachment points.
position{x, y, z}The 3d position of the attachment point on the located hand.
rotation{w, x, y, z}The rotation quaternion that rotates positive-Y vector to the attachment point bone vector.
innerPoint{x, y, z}The inner point of an attachment point. (ex. hand palm side)
outerPoint{x, y, z}The outer point of an attachment point. (ex. hand backside)
radiusNumberThe radius of finger attachment points.
minorRadiusNumberThe shortest radius from hand surface to the wrist attachment point.
majorRadiusNumberThe longest radius from hand surface to the wrist attachment point.

handupdated: Fires when a hand is subsequently found.

handupdated.detail : {id, transform, vertices, normals, attachmentPoints}

PropertyTypeDescription
idNumberA numerical id of the located hand.
transform{position, rotation, scale}Transform information of the located hand.
vertices[{x, y, z}]Position of hand points, relative to transform.
normals[{x, y, z}]Normal direction of vertices, relative to transform.
handKindNumberA numerical representation of the handedness of the located hand. Valid values are 0 (unspecified), 1 (left), and 2 (right).
attachmentPoints{name, position: {x,y,z}}See XR8.HandController.AttachmentPoints for list of available attachment points. position is relative to the transform.

transform is an object with the following properties:

PropertyTypeDescription
position{x, y, z}The 3d position of the located hand.
rotation{w, x, y, z}The 3d local orientation of the located hand.
scaleNumberA scale factor that should be applied to objects attached to this hand.

handlost: Fires when a hand is no longer being tracked.

handlost.detail : { id }

PropertyTypeDescription
idNumberA numerical id of the located hand.

Example - adding pipeline module

XR8.addCameraPipelineModule(XR8.HandController.pipelineModule())