浏览代码

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()) {
         if (!this._xrSessionManager.scene.isPhysicsEnabled()) {
             Logger.Warn("physics engine not enabled, skipped. Please add this controller manually.");
             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) => {
             xrController.onMotionControllerInitObservable.addOnce((motionController) => {
                 motionController.onModelLoadedObservable.addOnce(() => {
                 motionController.onModelLoadedObservable.addOnce(() => {
                     const impostor = new PhysicsImpostor(motionController.rootMesh!, PhysicsImpostor.MeshImpostor, {
                     const impostor = new PhysicsImpostor(motionController.rootMesh!, PhysicsImpostor.MeshImpostor, {