[英]Why does not render? / Aframe with three object3D
I want to use threejs with aframe.我想将threejs与aframe一起使用。 threejs object does not rendered.
Threejs 对象不呈现。
How can I render three object in aframe?如何在aframe中渲染三个对象?
html html
<a-scene>
<a-entity geometry material id="obje"></a-entity>
<a-entity camera id="cam"></a-entity>
</a-scene>
js js
window.addEventListener('load', init);
function init() {
width = document.body.clientWidth;
height = document.body.clientHeight;
camera = new THREE.PerspectiveCamera(100, width / height);
camera.position.set(0, 0, +1000);
const geometry = new THREE.BoxGeometry(400, 400, 400);
const material = new THREE.MeshNormalMaterial();
box = new THREE.Mesh(geometry, material);
const entityEl = document.querySelector('#obje');
entityEl.setObject3D('mesh', box);
const cam = document.querySelector('#cam');
cam.setObject3D('camera', camera);
};
Two main issues:两个主要问题:
THREE.PerspectiveCamera
and geometry and material set a mesh
on the entity with a geometry
and a material
.THREE.PerspectiveCamera
和 几何形状和 材料组中的mesh
上用所述实体geometry
和material
。 See glitch illustrating
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.