XRHandPrimitiveModel constructor
XRHandPrimitiveModel(
- XRHandModel handModel,
- WebXRController controller,
- String? path,
- String? handedness,
- Map<
String, dynamic> options,
Constructs a new XR hand primitive model.
@param {XRHandModel} handModel - The hand model. @param {Group} controller - The WebXR controller. @param {string} path - The model path. @param {XRHandedness} handedness - The handedness of the XR input source. @param {XRHandPrimitiveModel~Options} options - The model options.
Implementation
XRHandPrimitiveModel(this.handModel, this.controller, this.path, this.handedness, this.options ):super(){
BufferGeometry? geometry;
if (options['primitive'] == null || options['primitive'] == 'sphere' ) {
geometry = SphereGeometry( 1, 10, 10 );
}
else if( options['primitive'] == 'box' ) {
geometry = BoxGeometry( 1, 1, 1 );
}
final material = MeshStandardMaterial();
handMesh = InstancedMesh( geometry, material, 30 );
handMesh.frustumCulled = false;
handMesh.instanceMatrix?.setUsage( DynamicDrawUsage ); // will be updated every frame
handMesh.castShadow = true;
handMesh.receiveShadow = true;
handModel.add( handMesh );
}