|
@@ -15195,19 +15195,23 @@ var BABYLON;
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
/**
|
|
/**
|
|
- * Sets a new pivot matrix to the mesh.
|
|
|
|
- * Returns the AbstractMesh.
|
|
|
|
|
|
+ * Sets a new pivot matrix to the current node
|
|
|
|
+ * @param matrix defines the new pivot matrix to use
|
|
|
|
+ * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
|
|
|
|
+ * @returns the current TransformNode
|
|
*/
|
|
*/
|
|
TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
|
|
TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
|
|
if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
|
|
if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
|
|
this._pivotMatrix = matrix.clone();
|
|
this._pivotMatrix = matrix.clone();
|
|
this._cache.pivotMatrixUpdated = true;
|
|
this._cache.pivotMatrixUpdated = true;
|
|
this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
|
|
this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
|
|
- if (!this._pivotMatrixInverse) {
|
|
|
|
- this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
|
|
|
|
|
|
+ if (this._postMultiplyPivotMatrix) {
|
|
|
|
+ if (!this._pivotMatrixInverse) {
|
|
|
|
+ this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
@@ -15371,8 +15375,16 @@ var BABYLON;
|
|
BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
|
|
BABYLON.Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
- TransformNode.prototype.setPivotPoint = function (point, space) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Sets a new pivot point to the current node
|
|
|
|
+ * @param point defines the new pivot point to use
|
|
|
|
+ * @param space defines if the point is in world or local space (local by default)
|
|
|
|
+ * @param postMultiplyPivotMatrix defines if the pivot transformation must be cancelled in the world matrix. By default the pivot matrix is just applied at the beginning of the world matrix. When this parameter is set to true, the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
|
|
|
|
+ * @returns the current TransformNode
|
|
|
|
+ */
|
|
|
|
+ TransformNode.prototype.setPivotPoint = function (point, space, postMultiplyPivotMatrix) {
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
if (space === void 0) { space = BABYLON.Space.LOCAL; }
|
|
|
|
+ if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
|
|
if (this.getScene().getRenderId() == 0) {
|
|
if (this.getScene().getRenderId() == 0) {
|
|
this.computeWorldMatrix(true);
|
|
this.computeWorldMatrix(true);
|
|
}
|
|
}
|
|
@@ -15386,11 +15398,13 @@ var BABYLON;
|
|
this._pivotMatrix.m[12] = -point.x;
|
|
this._pivotMatrix.m[12] = -point.x;
|
|
this._pivotMatrix.m[13] = -point.y;
|
|
this._pivotMatrix.m[13] = -point.y;
|
|
this._pivotMatrix.m[14] = -point.z;
|
|
this._pivotMatrix.m[14] = -point.z;
|
|
- if (!this._pivotMatrixInverse) {
|
|
|
|
- this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
|
|
|
|
|
|
+ if (this._postMultiplyPivotMatrix) {
|
|
|
|
+ if (!this._pivotMatrixInverse) {
|
|
|
|
+ this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
this._cache.pivotMatrixUpdated = true;
|
|
this._cache.pivotMatrixUpdated = true;
|
|
return this;
|
|
return this;
|
|
@@ -15764,9 +15778,6 @@ var BABYLON;
|
|
this._afterComputeWorldMatrix();
|
|
this._afterComputeWorldMatrix();
|
|
// Absolute position
|
|
// Absolute position
|
|
this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
|
|
this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
|
|
- if (this._pivotMatrixInverse) {
|
|
|
|
- BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
|
|
|
|
- }
|
|
|
|
// Callbacks
|
|
// Callbacks
|
|
this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
|
|
this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
|
|
if (!this._poseMatrix) {
|
|
if (!this._poseMatrix) {
|