|
@@ -81,6 +81,9 @@
|
|
private _diffPositionForCollisions = new Vector3(0, 0, 0);
|
|
private _diffPositionForCollisions = new Vector3(0, 0, 0);
|
|
private _newPositionForCollisions = new Vector3(0, 0, 0);
|
|
private _newPositionForCollisions = new Vector3(0, 0, 0);
|
|
|
|
|
|
|
|
+ // Attach to bone
|
|
|
|
+ private _meshToBoneReferal: AbstractMesh;
|
|
|
|
+
|
|
// Cache
|
|
// Cache
|
|
private _localScaling = Matrix.Zero();
|
|
private _localScaling = Matrix.Zero();
|
|
private _localRotation = Matrix.Zero();
|
|
private _localRotation = Matrix.Zero();
|
|
@@ -88,6 +91,7 @@
|
|
private _localBillboard = Matrix.Zero();
|
|
private _localBillboard = Matrix.Zero();
|
|
private _localPivotScaling = Matrix.Zero();
|
|
private _localPivotScaling = Matrix.Zero();
|
|
private _localPivotScalingRotation = Matrix.Zero();
|
|
private _localPivotScalingRotation = Matrix.Zero();
|
|
|
|
+ private _localMeshReferalTransform: Matrix;
|
|
private _localWorld = Matrix.Zero();
|
|
private _localWorld = Matrix.Zero();
|
|
public _worldMatrix = Matrix.Zero();
|
|
public _worldMatrix = Matrix.Zero();
|
|
private _rotateYByPI = Matrix.RotationY(Math.PI);
|
|
private _rotateYByPI = Matrix.RotationY(Math.PI);
|
|
@@ -491,7 +495,17 @@
|
|
// Parent
|
|
// Parent
|
|
if (this.parent && this.parent.getWorldMatrix && this.billboardMode === AbstractMesh.BILLBOARDMODE_NONE) {
|
|
if (this.parent && this.parent.getWorldMatrix && this.billboardMode === AbstractMesh.BILLBOARDMODE_NONE) {
|
|
this._markSyncedWithParent();
|
|
this._markSyncedWithParent();
|
|
- this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
|
|
|
|
|
|
+
|
|
|
|
+ if (this._meshToBoneReferal) {
|
|
|
|
+ if (!this._localMeshReferalTransform) {
|
|
|
|
+ this._localMeshReferalTransform = Matrix.Zero();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._localMeshReferalTransform);
|
|
|
|
+ this._localMeshReferalTransform.multiplyToRef(this._meshToBoneReferal.getWorldMatrix(), this._worldMatrix);
|
|
|
|
+ } else {
|
|
|
|
+ this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
this._worldMatrix.copyFrom(this._localWorld);
|
|
this._worldMatrix.copyFrom(this._localWorld);
|
|
}
|
|
}
|
|
@@ -565,6 +579,16 @@
|
|
this.rotationQuaternion = Quaternion.RotationYawPitchRoll(yaw + yawCor, pitch + pitchCor, rollCor);
|
|
this.rotationQuaternion = Quaternion.RotationYawPitchRoll(yaw + yawCor, pitch + pitchCor, rollCor);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public attachToBone(bone: Bone, affectedMesh: AbstractMesh): void {
|
|
|
|
+ this._meshToBoneReferal = affectedMesh;
|
|
|
|
+ this.parent = bone;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public detachFromBone(): void {
|
|
|
|
+ this._meshToBoneReferal = null;
|
|
|
|
+ this.parent = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
public isInFrustum(frustumPlanes: Plane[]): boolean {
|
|
public isInFrustum(frustumPlanes: Plane[]): boolean {
|
|
return this._boundingInfo.isInFrustum(frustumPlanes);
|
|
return this._boundingInfo.isInFrustum(frustumPlanes);
|
|
}
|
|
}
|