2016-12-06 1 views
0

저는 씬에 벽을로드하고 Don McCurdy의 aframe-extras 스크립트에서 정적 바디 물리 컴포넌트를 적용하고 있습니다. 그러나, 나는 단지 두 개의 벽만이 충돌 자 (오른쪽 벽 & 오른쪽 열)로 행동하고 다른 모든 벽은 물리가 없습니다. 모든 벽에 물리 충돌기를로드하려면 어떻게합니까?OBJ 벽을 정적 바디로로드

-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 모델을로드 할 수,하지만 벽이 약간 더 복잡해질 때, 정전기 신체 구성 요소가 작동하지 않습니다.

답변

2

OBJ 모델 대신 벽을 만들기 위해 A 프레임 <a-box> 또는 <a-plane> 요소를 사용하려고하면 어떨까요? 당신이 복잡한 집 모델을 필요로하지 않는다면. 저는 여러분의 운동기구가 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> 
+0

벽에 대한 콜라다 파일은 정적 바디로 잘 수행됩니다. – Mark

+0

4면에 벽을 만들려고하고 있는데 벽을 따라 움직이지 않기를 바랍니다. 정적 바디가 포함 된 코드를 사용하고 있습니다. 카메라는 여전히 벽을 통과합니다. 이것을 막을 수있는 방법이 있습니까? – AishApp

+0

@AishApp 카메라에'kinematic-body' 컴포넌트를 추가 했습니까? –

관련 문제