Bläddra i källkod

warning if physics engine not enabled

Raanan Weber 5 år sedan
förälder
incheckning
f31d69cf37
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. 5 1
      src/Cameras/XR/features/WebXRControllerPhysics.ts

+ 5 - 1
src/Cameras/XR/features/WebXRControllerPhysics.ts

@@ -7,6 +7,7 @@ import { WebXRSessionManager } from "../webXRSessionManager";
 import { AbstractMesh } from "../../../Meshes/abstractMesh";
 import { SphereBuilder } from "../../../Meshes/Builders/sphereBuilder";
 import { WebXRFeatureName, WebXRFeaturesManager } from "../webXRFeaturesManager";
+import { Logger } from '../../../Misc/logger';
 
 /**
  * Options for the controller physics feature
@@ -150,7 +151,7 @@ export class WebXRControllerPhysics extends WebXRAbstractFeature {
     }
 
     /**
-     * Manually add a controller (if no xrInput was provided)
+     * Manually add a controller (if no xrInput was provided or physics engine was not enabled)
      * @param xrController the controller to add
      */
     public addController(xrController: WebXRController) {
@@ -179,6 +180,9 @@ export class WebXRControllerPhysics extends WebXRAbstractFeature {
             // already attached
             return;
         }
+        if (!this._xrSessionManager.scene.isPhysicsEnabled()) {
+            Logger.Warn("physics engine not enabled, skipped. Please add this controller manually.");
+        }
         if (this._options.physicsProperties!.useControllerMesh) {
             xrController.onMotionControllerProfileLoaded.addOnce((motionController) => {
                 motionController.onModelLoadedObservable.addOnce(() => {