|
@@ -9,9 +9,9 @@ import { Quaternion, Vector3 } from '../../Maths/math.vector';
|
|
import { Mesh } from '../../Meshes/mesh';
|
|
import { Mesh } from '../../Meshes/mesh';
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Handness type in xrInput profiles. These can be used to define layouts in the Layout Map.
|
|
|
|
|
|
+ * Handedness type in xrInput profiles. These can be used to define layouts in the Layout Map.
|
|
*/
|
|
*/
|
|
-export type MotionControllerHandness = "none" | "left" | "right";
|
|
|
|
|
|
+export type MotionControllerHandedness = "none" | "left" | "right";
|
|
/**
|
|
/**
|
|
* The type of components available in motion controllers.
|
|
* The type of components available in motion controllers.
|
|
* This is not the name of the component.
|
|
* This is not the name of the component.
|
|
@@ -122,9 +122,9 @@ export interface IMotionControllerLayout {
|
|
*/
|
|
*/
|
|
export interface IMotionControllerLayoutMap {
|
|
export interface IMotionControllerLayoutMap {
|
|
/**
|
|
/**
|
|
- * Layouts with handness type as a key
|
|
|
|
|
|
+ * Layouts with handedness type as a key
|
|
*/
|
|
*/
|
|
- [handness: string /* handness */]: IMotionControllerLayout;
|
|
|
|
|
|
+ [handedness: string /* handedness */]: IMotionControllerLayout;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -138,7 +138,7 @@ export interface IMotionControllerProfile {
|
|
*/
|
|
*/
|
|
fallbackProfileIds: string[];
|
|
fallbackProfileIds: string[];
|
|
/**
|
|
/**
|
|
- * The layout map, with handness as key
|
|
|
|
|
|
+ * The layout map, with handedness as key
|
|
*/
|
|
*/
|
|
layouts: IMotionControllerLayoutMap;
|
|
layouts: IMotionControllerLayoutMap;
|
|
/**
|
|
/**
|
|
@@ -268,7 +268,7 @@ export abstract class WebXRAbstractMotionController implements IDisposable {
|
|
* @param scene the scene to which the model of the controller will be added
|
|
* @param scene the scene to which the model of the controller will be added
|
|
* @param layout The profile layout to load
|
|
* @param layout The profile layout to load
|
|
* @param gamepadObject The gamepad object correlating to this controller
|
|
* @param gamepadObject The gamepad object correlating to this controller
|
|
- * @param handness handness (left/right/none) of this controller
|
|
|
|
|
|
+ * @param handedness handedness (left/right/none) of this controller
|
|
* @param _doNotLoadControllerMesh set this flag to ignore the mesh loading
|
|
* @param _doNotLoadControllerMesh set this flag to ignore the mesh loading
|
|
*/
|
|
*/
|
|
constructor(protected scene: Scene, protected layout: IMotionControllerLayout,
|
|
constructor(protected scene: Scene, protected layout: IMotionControllerLayout,
|
|
@@ -277,9 +277,9 @@ export abstract class WebXRAbstractMotionController implements IDisposable {
|
|
*/
|
|
*/
|
|
public gamepadObject: IMinimalMotionControllerObject,
|
|
public gamepadObject: IMinimalMotionControllerObject,
|
|
/**
|
|
/**
|
|
- * handness (left/right/none) of this controller
|
|
|
|
|
|
+ * handedness (left/right/none) of this controller
|
|
*/
|
|
*/
|
|
- public handness: MotionControllerHandness,
|
|
|
|
|
|
+ public handedness: MotionControllerHandedness,
|
|
_doNotLoadControllerMesh: boolean = false) {
|
|
_doNotLoadControllerMesh: boolean = false) {
|
|
// initialize the components
|
|
// initialize the components
|
|
if (layout.components) {
|
|
if (layout.components) {
|
|
@@ -383,6 +383,13 @@ export abstract class WebXRAbstractMotionController implements IDisposable {
|
|
this.updateModel(xrFrame);
|
|
this.updateModel(xrFrame);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Backwards compatibility due to a deeply-integrated typo
|
|
|
|
+ */
|
|
|
|
+ public get handness() {
|
|
|
|
+ return this.handedness;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Look through all children recursively. This will return null if no mesh exists with the given name.
|
|
// Look through all children recursively. This will return null if no mesh exists with the given name.
|
|
protected _getChildByName(node: AbstractMesh, name: string): AbstractMesh {
|
|
protected _getChildByName(node: AbstractMesh, name: string): AbstractMesh {
|
|
return <AbstractMesh>node.getChildren((n) => n.name === name, false)[0];
|
|
return <AbstractMesh>node.getChildren((n) => n.name === name, false)[0];
|
|
@@ -470,7 +477,7 @@ export abstract class WebXRAbstractMotionController implements IDisposable {
|
|
}
|
|
}
|
|
|
|
|
|
private _getGenericParentMesh(meshes: AbstractMesh[]): void {
|
|
private _getGenericParentMesh(meshes: AbstractMesh[]): void {
|
|
- this.rootMesh = new Mesh(this.profileId + " " + this.handness, this.scene);
|
|
|
|
|
|
+ this.rootMesh = new Mesh(this.profileId + " " + this.handedness, this.scene);
|
|
|
|
|
|
meshes.forEach((mesh) => {
|
|
meshes.forEach((mesh) => {
|
|
if (!mesh.parent) {
|
|
if (!mesh.parent) {
|