Bläddra i källkod

Merge pull request #3367 from TrevorDev/fixControllerRotationOnlySetWhenMeshSet

set controller's deviceRotationQuaternion even when there is no mesh set
David Catuhe 7 år sedan
förälder
incheckning
f0c0a5143c
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      src/Gamepad/Controllers/babylon.poseEnabledController.ts

+ 3 - 2
src/Gamepad/Controllers/babylon.poseEnabledController.ts

@@ -88,12 +88,13 @@ module BABYLON {
             Vector3.TransformCoordinatesToRef(this._calculatedPosition, this._deviceToWorld, this.devicePosition)
             this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix);
             Quaternion.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);
-
+            this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation)
+            
             if (this._mesh) {
                 this._mesh.position.copyFrom(this.devicePosition);
 
                 if (this._mesh.rotationQuaternion) {
-                    this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation));
+                    this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion);
                 }
             }
         }