Jelajahi Sumber

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

Trevor Baron 8 tahun lalu
induk
melakukan
4e5925853c
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      src/Cameras/VR/babylon.webVRCamera.ts

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

@@ -179,9 +179,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);