소스 검색

physics controls with no motion controller

Raanan Weber 5 년 전
부모
커밋
b231b78bac
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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, {