|
@@ -295,15 +295,15 @@ var BABYLON = BABYLON || {};
|
|
|
this._localPivotScalingRotation.multiplyToRef(this._localBillboard, this._localWorld);
|
|
|
this._rotateYByPI.multiplyToRef(this._localWorld, this._localPivotScalingRotation);
|
|
|
}
|
|
|
+
|
|
|
+ // Local world
|
|
|
+ this._localPivotScalingRotation.multiplyToRef(this._localTranslation, this._localWorld);
|
|
|
|
|
|
// Parent
|
|
|
if (this.parent && this.parent.getWorldMatrix && this.billboardMode === BABYLON.Mesh.BILLBOARDMODE_NONE) {
|
|
|
- this._localPivotScalingRotation.multiplyToRef(this._localTranslation, this._localWorld);
|
|
|
- var parentWorld = this.parent.getWorldMatrix();
|
|
|
-
|
|
|
- this._localWorld.multiplyToRef(parentWorld, this._worldMatrix);
|
|
|
+ this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
|
|
|
} else {
|
|
|
- this._localPivotScalingRotation.multiplyToRef(this._localTranslation, this._worldMatrix);
|
|
|
+ this._worldMatrix = this._localWorld;
|
|
|
}
|
|
|
|
|
|
// Bounding info
|
|
@@ -533,21 +533,24 @@ var BABYLON = BABYLON || {};
|
|
|
};
|
|
|
|
|
|
// Geometry
|
|
|
- BABYLON.Mesh.prototype.setLocalTranslation = function(vector3) {
|
|
|
+ BABYLON.Mesh.prototype.setPositionWithLocalVector = function(vector3) {
|
|
|
+ this.computeWorldMatrix();
|
|
|
+
|
|
|
+ this.position = BABYLON.Vector3.TransformNormal(vector3, this._localWorld);
|
|
|
+ };
|
|
|
+
|
|
|
+ BABYLON.Mesh.prototype.getPositionExpressedInLocalSpace = function () {
|
|
|
this.computeWorldMatrix();
|
|
|
- var worldMatrix = this._worldMatrix.clone();
|
|
|
- worldMatrix.setTranslation(BABYLON.Vector3.Zero());
|
|
|
+ var invLocalWorldMatrix = this._localWorld.clone();
|
|
|
+ invLocalWorldMatrix.invert();
|
|
|
|
|
|
- this.position = BABYLON.Vector3.TransformCoordinates(vector3, worldMatrix);
|
|
|
+ return BABYLON.Vector3.TransformNormal(this.position, invLocalWorldMatrix);
|
|
|
};
|
|
|
|
|
|
- BABYLON.Mesh.prototype.getLocalTranslation = function () {
|
|
|
+ BABYLON.Mesh.prototype.locallyTranslate = function(vector3) {
|
|
|
this.computeWorldMatrix();
|
|
|
- var invWorldMatrix = this._worldMatrix.clone();
|
|
|
- invWorldMatrix.setTranslation(BABYLON.Vector3.Zero());
|
|
|
- invWorldMatrix.invert();
|
|
|
-
|
|
|
- return BABYLON.Vector3.TransformCoordinates(this.position, invWorldMatrix);
|
|
|
+
|
|
|
+ this.position = BABYLON.Vector3.TransformCoordinates(vector3, this._localWorld);
|
|
|
};
|
|
|
|
|
|
BABYLON.Mesh.prototype.bakeTransformIntoVertices = function (transform) {
|