Aframe 如何将一个帧场景嵌入到div中
我试图将一个.OBJ模型嵌入到一个元素中,这样它就被限制在一个特定的宽度和高度,而不是一个完整的页面画布。我试图复制嵌入到标题中的“场景”。我希望场景中的摄影机围绕模型的中心轴平移(如示例中所示) 我很难做到这一点。。。到目前为止,我能够成功地将以下afame场景加载到我的浏览器中:Aframe 如何将一个帧场景嵌入到div中,aframe,Aframe,我试图将一个.OBJ模型嵌入到一个元素中,这样它就被限制在一个特定的宽度和高度,而不是一个完整的页面画布。我试图复制嵌入到标题中的“场景”。我希望场景中的摄影机围绕模型的中心轴平移(如示例中所示) 我很难做到这一点。。。到目前为止,我能够成功地将以下afame场景加载到我的浏览器中: <a-scene> <a-box color="#6173F4" width="4" height="10" depth="2"></a-box> </a-scene&
<a-scene>
<a-box color="#6173F4" width="4" height="10" depth="2"></a-box>
</a-scene>
如果有人能告诉我怎么做,我会非常感激,
谢谢。A-Frame的嵌入式组件旨在删除全屏样式,允许您根据需要设置画布的样式/大小
<a-scene embedded></a-scene>
唐麦克迪,
谢谢你给我指明了正确的方向。我终于改变了场景窗口的大小
以下是完成此操作的代码
HTML:
<a-scene class="aframebox" embedded>
<a-sphere position="0 1.25 -1" radius="1.25" color="#EF2D5E"></a-sphere>
<a-box position="-1 0.5 1" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
<a-cylinder position="1 0.75 1" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
<a-plane rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
<a-entity position="0 0 3.8">
<a-camera></a-camera>
</a-entity>
</a-scene>
.aframebox {
height: 500px;
width: 500px;
}