Prechádzať zdrojové kódy

physics controls with no motion controller

Raanan Weber 5 rokov pred
rodič
commit
b231b78bac
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  1. 2 1
      src/XR/features/WebXRControllerPhysics.ts

+ 2 - 1
src/XR/features/WebXRControllerPhysics.ts

@@ -85,7 +85,8 @@ export class WebXRControllerPhysics extends WebXRAbstractFeature {
         if (!this._xrSessionManager.scene.isPhysicsEnabled()) {
             Logger.Warn("physics engine not enabled, skipped. Please add this controller manually.");
         }
-        if (this._options.physicsProperties!.useControllerMesh) {
+        // if no motion controller available, create impostors!
+        if (this._options.physicsProperties!.useControllerMesh && xrController.inputSource.gamepad) {
             xrController.onMotionControllerInitObservable.addOnce((motionController) => {
                 motionController.onModelLoadedObservable.addOnce(() => {
                     const impostor = new PhysicsImpostor(motionController.rootMesh!, PhysicsImpostor.MeshImpostor, {