Pārlūkot izejas kodu

Fi forwardRay when no mesh was laoded for controller

David Catuhe 8 gadi atpakaļ
vecāks
revīzija
1d0a193b94

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 569 - 569
dist/preview release/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 11 - 11
dist/preview release/babylon.js


+ 4 - 1
dist/preview release/babylon.max.js

@@ -46130,6 +46130,9 @@ var BABYLON;
         });
         PoseEnabledController.prototype.getForwardRay = function (length) {
             if (length === void 0) { length = 100; }
+            if (!this.mesh) {
+                return new BABYLON.Ray(BABYLON.Vector3.Zero(), new BABYLON.Vector3(0, 0, 1), length);
+            }
             var m = this.mesh.getWorldMatrix();
             var origin = m.getTranslation();
             var forward = new BABYLON.Vector3(0, 0, -1);
@@ -59080,7 +59083,7 @@ var BABYLON;
         ;
         WebVRFreeCamera.prototype.getForwardRay = function (length) {
             if (length === void 0) { length = 100; }
-            var m = this.getWorldMatrix();
+            var m = this.leftCamera.getWorldMatrix();
             var origin = this.position.add(this.devicePosition);
             var forward = new BABYLON.Vector3(0, 0, 1);
             var forwardWorld = BABYLON.Vector3.TransformNormal(forward, m);

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 569 - 569
dist/preview release/babylon.module.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 11 - 11
dist/preview release/babylon.worker.js


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

@@ -215,7 +215,7 @@ module BABYLON {
         };
 
         public getForwardRay(length = 100): Ray {
-            var m = this.getWorldMatrix();
+            var m = this.leftCamera.getWorldMatrix();
 
             var origin = this.position.add(this.devicePosition);
 

+ 4 - 0
src/Tools/babylon.extendedGamepad.ts

@@ -127,6 +127,10 @@ module BABYLON {
         }
 
         public getForwardRay(length = 100): Ray {
+            if (!this.mesh) {
+                return new Ray(Vector3.Zero(), new BABYLON.Vector3(0, 0, 1), length);
+            }
+
             var m = this.mesh.getWorldMatrix();
             var origin = m.getTranslation();