@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
147 lines (146 loc) • 3.25 kB
TypeScript
/**
* Represents the joint of a finger.
*
* @category XR
*/
export class XrJoint {
/**
* Create an XrJoint instance.
*
* @param {number} index - Index of a joint within a finger.
* @param {string} id - Id of a joint based on WebXR Hand Input Specs.
* @param {import('./xr-hand.js').XrHand} hand - Hand that joint relates to.
* @param {import('./xr-finger.js').XrFinger|null} finger - Finger that joint is related to.
* Can be null in the case of the wrist joint.
* @ignore
*/
constructor(index: number, id: string, hand: import("./xr-hand.js").XrHand, finger?: import("./xr-finger.js").XrFinger | null);
/**
* @type {number}
* @private
*/
private _index;
/**
* @type {string}
* @private
*/
private _id;
/**
* @type {import('./xr-hand.js').XrHand}
* @private
*/
private _hand;
/**
* @type {import('./xr-finger.js').XrFinger}
* @private
*/
private _finger;
/**
* @type {boolean}
* @private
*/
private _wrist;
/**
* @type {boolean}
* @private
*/
private _tip;
/**
* @type {number}
* @private
*/
private _radius;
/**
* @type {Mat4}
* @private
*/
private _localTransform;
/**
* @type {Mat4}
* @private
*/
private _worldTransform;
/**
* @type {Vec3}
* @private
*/
private _localPosition;
/**
* @type {Quat}
* @private
*/
private _localRotation;
/**
* @type {Vec3}
* @private
*/
private _position;
/**
* @type {Quat}
* @private
*/
private _rotation;
/**
* @type {boolean}
* @private
*/
private _dirtyLocal;
/**
* @param {XRJointPose} pose - XRJointPose of this joint.
* @ignore
*/
update(pose: XRJointPose): void;
/** @private */
private _updateTransforms;
/**
* Get the world space position of a joint.
*
* @returns {Vec3} The world space position of a joint.
*/
getPosition(): Vec3;
/**
* Get the world space rotation of a joint.
*
* @returns {Quat} The world space rotation of a joint.
*/
getRotation(): Quat;
/**
* Index of a joint within a finger, starting from 0 (root of a finger) all the way to tip of
* the finger.
*
* @type {number}
*/
get index(): number;
/**
* Hand that joint relates to.
*
* @type {import('./xr-hand.js').XrHand}
*/
get hand(): import("./xr-hand.js").XrHand;
/**
* Finger that joint relates to.
*
* @type {import('./xr-finger.js').XrFinger|null}
*/
get finger(): import("./xr-finger.js").XrFinger | null;
/**
* True if joint is a wrist.
*
* @type {boolean}
*/
get wrist(): boolean;
/**
* True if joint is a tip of a finger.
*
* @type {boolean}
*/
get tip(): boolean;
/**
* The radius of a joint, which is a distance from joint to the edge of a skin.
*
* @type {number}
*/
get radius(): number;
}
import { Vec3 } from '../../core/math/vec3.js';
import { Quat } from '../../core/math/quat.js';