@pmndrs/xr
Version:
VR/AR for threejs
18 lines (17 loc) • 706 B
JavaScript
import { Object3D } from 'three';
import { onXRFrame } from './utils.js';
import { configureXRHandModel, createUpdateXRHandVisuals, loadXRHandModel } from '../hand/index.js';
import { getSpaceFromAncestors } from '../space.js';
export class XRHandModel extends Object3D {
constructor(state, options) {
super();
let update = () => { };
onXRFrame((frame) => update(frame));
loadXRHandModel(state.assetPath).then((model) => {
this.add(model);
state.object = model;
configureXRHandModel(model, options);
update = createUpdateXRHandVisuals(state.inputSource.hand, model, () => getSpaceFromAncestors(this));
});
}
}