|
@@ -17598,6 +17598,7 @@ var BABYLON;
|
|
|
this._scene = (scene || BABYLON.Engine.LastCreatedScene);
|
|
|
this.uniqueId = this._scene.getUniqueId();
|
|
|
this._initCache();
|
|
|
+ this._scene.rootNodes.push(this);
|
|
|
}
|
|
|
/**
|
|
|
* Add a new node constructor
|
|
@@ -17640,12 +17641,17 @@ var BABYLON;
|
|
|
if (this._parentNode === parent) {
|
|
|
return;
|
|
|
}
|
|
|
+ var previousParentNode = this._parentNode;
|
|
|
// Remove self from list of children of parent
|
|
|
if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {
|
|
|
var index = this._parentNode._children.indexOf(this);
|
|
|
if (index !== -1) {
|
|
|
this._parentNode._children.splice(index, 1);
|
|
|
}
|
|
|
+ if (!parent) {
|
|
|
+ // Need to add this node to the rootNodes
|
|
|
+ this._scene.rootNodes.push(this);
|
|
|
+ }
|
|
|
}
|
|
|
// Store new parent
|
|
|
this._parentNode = parent;
|
|
@@ -17655,6 +17661,13 @@ var BABYLON;
|
|
|
this._parentNode._children = new Array();
|
|
|
}
|
|
|
this._parentNode._children.push(this);
|
|
|
+ if (!previousParentNode) {
|
|
|
+ // Need to remove from rootNodes
|
|
|
+ var rootNodeIndex = this._scene.rootNodes.indexOf(this);
|
|
|
+ if (rootNodeIndex > -1) {
|
|
|
+ this._scene.rootNodes.splice(rootNodeIndex, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
enumerable: true,
|
|
@@ -17952,6 +17965,9 @@ var BABYLON;
|
|
|
* @returns an array of {BABYLON.Node}
|
|
|
*/
|
|
|
Node.prototype.getChildren = function (predicate) {
|
|
|
+ if (!predicate) {
|
|
|
+ return this._children;
|
|
|
+ }
|
|
|
return this.getDescendants(true, predicate);
|
|
|
};
|
|
|
/** @hidden */
|
|
@@ -18085,7 +18101,15 @@ var BABYLON;
|
|
|
transformNode.computeWorldMatrix(true);
|
|
|
}
|
|
|
}
|
|
|
- this.parent = null;
|
|
|
+ if (!this.parent) {
|
|
|
+ var rootNodeIndex = this._scene.rootNodes.indexOf(this);
|
|
|
+ if (rootNodeIndex > -1) {
|
|
|
+ this._scene.rootNodes.splice(rootNodeIndex, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.parent = null;
|
|
|
+ }
|
|
|
// Callback
|
|
|
this.onDisposeObservable.notifyObservers(this);
|
|
|
this.onDisposeObservable.clear();
|
|
@@ -23784,6 +23808,10 @@ var BABYLON;
|
|
|
*/
|
|
|
var AbstractScene = /** @class */ (function () {
|
|
|
function AbstractScene() {
|
|
|
+ /**
|
|
|
+ * Gets the list of root nodes (ie. nodes with no parent)
|
|
|
+ */
|
|
|
+ this.rootNodes = new Array();
|
|
|
/** All of the cameras added to this scene
|
|
|
* @see http://doc.babylonjs.com/babylon101/cameras
|
|
|
*/
|
|
@@ -98367,7 +98395,7 @@ var BABYLON;
|
|
|
// Listening to the proper controller values changes to confirm teleportation
|
|
|
if (Math.sqrt(stateObject.y * stateObject.y + stateObject.x * stateObject.x) < this._padSensibilityDown) {
|
|
|
if (this._teleportActive) {
|
|
|
- this._teleportCamera(this._haloCenter);
|
|
|
+ this.teleportCamera(this._haloCenter);
|
|
|
}
|
|
|
gazer._teleportationRequestInitiated = false;
|
|
|
}
|
|
@@ -98436,7 +98464,7 @@ var BABYLON;
|
|
|
var ray = new BABYLON.Ray(position, this._workingVector);
|
|
|
var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
|
|
|
if (hit && hit.pickedPoint && hit.pickedMesh && this._isTeleportationFloor(hit.pickedMesh) && hit.distance < 5) {
|
|
|
- this._teleportCamera(hit.pickedPoint);
|
|
|
+ this.teleportCamera(hit.pickedPoint);
|
|
|
}
|
|
|
gazer._teleportationBackRequestInitiated = true;
|
|
|
}
|
|
@@ -98626,7 +98654,11 @@ var BABYLON;
|
|
|
this._teleportationTarget.position.y += 0.1;
|
|
|
}
|
|
|
};
|
|
|
- VRExperienceHelper.prototype._teleportCamera = function (location) {
|
|
|
+ /**
|
|
|
+ * Teleports the users feet to the desired location
|
|
|
+ * @param location The location where the user's feet should be placed
|
|
|
+ */
|
|
|
+ VRExperienceHelper.prototype.teleportCamera = function (location) {
|
|
|
var _this = this;
|
|
|
if (!(this.currentVRCamera instanceof BABYLON.FreeCamera)) {
|
|
|
return;
|