加载 OBJ 墙作为静态体

Loading OBJ walls as a static-body

我正在将墙壁加载到我的场景中并应用 Don McCurdy 的 aframe-extras 脚本中的静态物理组件。然而,我只有两堵墙表现得像对撞机(右墙和右栏),而所有其他墙都是物理自由的。如何在所有墙壁上加载物理碰撞器?

查看演示 - https://mannymeadows.github.io/Noosa/。我错过了什么?

<html>
<head>
  <script src="https://aframe.io/releases/0.3.2/aframe.min.js"></script>
  <script src="https://mannymeadows.github.io/Noosa/aframe-extras.js" 
  </script>
</head>
<body>
 <a-scene physics>
   <a-assets>
     <img id="sky" src="https://mannymeadows.github.io/Noosa/models/pano-
     test.jpg">
     <a-asset-item id="room-obj" 
     src="https://mannymeadows.github.io/Noosa/models/shop-walls.obj">
     </a-asset-item>
     <a-asset-item id="stool-obj" 
     src="https://mannymeadows.github.io/Noosa/models/riva1920_onelove_obj.obj">  
     </a-asset-item>
     <a-asset-item id="stool-mtl" 
     src="https://mannymeadows.github.io/Noosa/models/riva1920_onelove_obj.mtl">
     </a-asset-item>
   </a-assets>
   <!-- Player -->
   <a-entity camera                
     universal-controls
     look-controls
     kinematic-body
     position="0 1.764 0">
   </a-entity>
   <!-- Floor -->
   <a-plane rotation="-90 0 0" width="54" height="54" color="#e2c5c9" 
   static-body></a-plane>
   <!-- Sky -->
   <a-sky src="#sky"></a-sky>
   <!-- Wall collider -->      
   <a-entity static-body obj-model="obj: #room-obj"></a-entity>
   <!-- furniture -->
   <a-entity static-body scale="0.05 0.05 0.05" rotation="-90 0 0" 
   position="0 0 -5" obj-model="obj: #stool-obj; mtl: #stool-mtl"></a-entity>
 </a-scene>
</body>
</html>

我可以加载应用物理的简单墙 OBJ 模型,但是当墙变得稍微复杂时,静态组件将无法工作。

尝试使用A-Frame<a-box><a-plane>元素而不是 OBJ 模型来制作墙怎么样?如果您不需要复杂的房屋模型。我认为您的运动 body 对 OBJ 模型的边界框有影响。 我的代码是这样的:

<a-entity id="house">
  <a-plane width="5"
    id="rightwall"
    height="3"
    position="2.5 1.6 -2.5"
    rotation = "0 90 0"
    material="side:double">
  </a-plane>
  <a-plane width="5"
    id="leftwall"
    height="3"
    position="0 1.6 -5"
    material="side:double">
  </a-plane>
  <a-plane width="5"
    id="backwall"
    height="3"
    position="0 1.6 0"
    material="side:double">
  </a-plane>
</a-entity>