Przeglądaj źródła

Make sure that the gaze cursor is correctly in front of the user

Trevor Baron 7 lat temu
rodzic
commit
3836fe1576
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      src/Cameras/VR/babylon.webVRCamera.ts

+ 4 - 1
src/Cameras/VR/babylon.webVRCamera.ts

@@ -180,9 +180,12 @@ module BABYLON {
             return this._rightController;
             return this._rightController;
         };
         };
 
 
+
+        
         public getForwardRay(length = 100): Ray {
         public getForwardRay(length = 100): Ray {
             if (this.leftCamera) {
             if (this.leftCamera) {
-                return super.getForwardRay(length, this.leftCamera.getWorldMatrix(), this.position.add(this.devicePosition)); // Need the actual rendered camera
+                // Use left eye to avoid computation to compute center on every call
+                return super.getForwardRay(length, this.leftCamera.getWorldMatrix(), this.leftCamera.globalPosition); // Need the actual rendered camera
             }
             }
             else {
             else {
                 return super.getForwardRay(length);
                 return super.getForwardRay(length);