我想在相机上附加一个对象,使其成为相机看起来,转弯等任何地方的对象。我试图这样做:
<html>
<head>
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<a-asset-item id="gun" position="0 -1 -5" rotation="90 360 0" scale="0 0 0" src="gun.gltf"></a-asset-item>
<a-entity camera="active: true" look-controls wasd-controls position="0 0 5" data-aframe-default-camera></a-entity>
<a-entity camera look-controls>
<a-entity gltf-model="#gun" position="0 -1 -5" rotation="0 90 35" scale="0.4 0.4 0.4" id="my_gun"></a-entity>
</a-entity>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
</body>
</html>
但这在position="0 -1 -5"
上一直保持不变,如果此时我不使用位置,则说明相机位于对象内部...如何解决此问题?
答案 0 :(得分:0)
您必须更改
<a-entity camera="active: true" look-controls wasd-controls position="0 0 5" data-aframe-default-camera></a-entity>
<a-entity camera look-controls>
<a-entity gltf-model="#gun" position="0 -1 -5" rotation="0 90 35" scale="0.4 0.4 0.4" id="my_gun"></a-entity>
</a-entity>
到
<a-entity camera="active: true" look-controls wasd-controls position="0 0 5" data-aframe-default-camera>
<a-entity gltf-model="#gun" position="0 -1 -5" rotation="0 90 35" scale="0.4 0.4 0.4" id="my_gun">
</a-entity>
</a-entity>
有两个不同的相机,我认为这是问题所在。