|
@@ -52557,7 +52557,8 @@ var BABYLON;
|
|
'THUMBSTICK_Y',
|
|
'THUMBSTICK_Y',
|
|
'TOUCHPAD_TOUCH_X',
|
|
'TOUCHPAD_TOUCH_X',
|
|
'TOUCHPAD_TOUCH_Y'
|
|
'TOUCHPAD_TOUCH_Y'
|
|
- ]
|
|
|
|
|
|
+ ],
|
|
|
|
+ pointingPoseMeshName: 'POINTING_POSE'
|
|
};
|
|
};
|
|
_this.onTrackpadChangedObservable = new BABYLON.Observable();
|
|
_this.onTrackpadChangedObservable = new BABYLON.Observable();
|
|
_this.controllerType = BABYLON.PoseEnabledControllerType.WINDOWS;
|
|
_this.controllerType = BABYLON.PoseEnabledControllerType.WINDOWS;
|
|
@@ -52717,13 +52718,10 @@ var BABYLON;
|
|
var childMesh = null;
|
|
var childMesh = null;
|
|
for (var i = 0; i < meshes.length; i++) {
|
|
for (var i = 0; i < meshes.length; i++) {
|
|
var mesh = meshes[i];
|
|
var mesh = meshes[i];
|
|
- if (mesh.id === WindowsMotionController.MODEL_ROOT_NODE_NAME) {
|
|
|
|
- // There may be a parent mesh to perform the RH to LH matrix transform.
|
|
|
|
|
|
+ if (!mesh.parent) {
|
|
// Exclude controller meshes from picking results
|
|
// Exclude controller meshes from picking results
|
|
mesh.isPickable = false;
|
|
mesh.isPickable = false;
|
|
// Handle root node, attach to the new parentMesh
|
|
// Handle root node, attach to the new parentMesh
|
|
- if (mesh.parent && mesh.parent.name === WindowsMotionController.GLTF_ROOT_TRANSFORM_NAME)
|
|
|
|
- mesh = mesh.parent;
|
|
|
|
childMesh = mesh;
|
|
childMesh = mesh;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -52734,7 +52732,7 @@ var BABYLON;
|
|
loadedMeshInfo = this.createMeshInfo(parentMesh);
|
|
loadedMeshInfo = this.createMeshInfo(parentMesh);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- BABYLON.Tools.Warn('No node with name ' + WindowsMotionController.MODEL_ROOT_NODE_NAME + ' in model file.');
|
|
|
|
|
|
+ BABYLON.Tools.Warn('Could not find root node in model file.');
|
|
}
|
|
}
|
|
return loadedMeshInfo;
|
|
return loadedMeshInfo;
|
|
};
|
|
};
|
|
@@ -52805,6 +52803,11 @@ var BABYLON;
|
|
')');
|
|
')');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // Pointing Ray
|
|
|
|
+ loadedMeshInfo.pointingPoseNode = getChildByName(rootNode, this._mapping.pointingPoseMeshName);
|
|
|
|
+ if (!loadedMeshInfo.pointingPoseNode) {
|
|
|
|
+ BABYLON.Tools.Warn('Missing pointing pose mesh with name: ' + this._mapping.pointingPoseMeshName);
|
|
|
|
+ }
|
|
return loadedMeshInfo;
|
|
return loadedMeshInfo;
|
|
// 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.
|
|
function getChildByName(node, name) {
|
|
function getChildByName(node, name) {
|
|
@@ -52815,6 +52818,18 @@ var BABYLON;
|
|
return node.getChildMeshes(true, function (n) { return n.name == name; })[0];
|
|
return node.getChildMeshes(true, function (n) { return n.name == name; })[0];
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ WindowsMotionController.prototype.getForwardRay = function (length) {
|
|
|
|
+ if (length === void 0) { length = 100; }
|
|
|
|
+ if (!(this._loadedMeshInfo && this._loadedMeshInfo.pointingPoseNode)) {
|
|
|
|
+ return _super.prototype.getForwardRay.call(this, length);
|
|
|
|
+ }
|
|
|
|
+ var m = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix();
|
|
|
|
+ var origin = m.getTranslation();
|
|
|
|
+ var forward = new BABYLON.Vector3(0, 0, -1);
|
|
|
|
+ var forwardWorld = BABYLON.Vector3.TransformNormal(forward, m);
|
|
|
|
+ var direction = BABYLON.Vector3.Normalize(forwardWorld);
|
|
|
|
+ return new BABYLON.Ray(origin, direction, length);
|
|
|
|
+ };
|
|
WindowsMotionController.prototype.dispose = function () {
|
|
WindowsMotionController.prototype.dispose = function () {
|
|
_super.prototype.dispose.call(this);
|
|
_super.prototype.dispose.call(this);
|
|
this.onTrackpadChangedObservable.clear();
|
|
this.onTrackpadChangedObservable.clear();
|
|
@@ -52822,8 +52837,6 @@ var BABYLON;
|
|
WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/microsoft/';
|
|
WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/microsoft/';
|
|
WindowsMotionController.MODEL_LEFT_FILENAME = 'left.glb';
|
|
WindowsMotionController.MODEL_LEFT_FILENAME = 'left.glb';
|
|
WindowsMotionController.MODEL_RIGHT_FILENAME = 'right.glb';
|
|
WindowsMotionController.MODEL_RIGHT_FILENAME = 'right.glb';
|
|
- WindowsMotionController.MODEL_ROOT_NODE_NAME = 'RootNode';
|
|
|
|
- WindowsMotionController.GLTF_ROOT_TRANSFORM_NAME = 'root';
|
|
|
|
WindowsMotionController.GAMEPAD_ID_PREFIX = 'Spatial Controller (Spatial Interaction Source) ';
|
|
WindowsMotionController.GAMEPAD_ID_PREFIX = 'Spatial Controller (Spatial Interaction Source) ';
|
|
WindowsMotionController.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/;
|
|
WindowsMotionController.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/;
|
|
return WindowsMotionController;
|
|
return WindowsMotionController;
|