【发布时间】:2016-01-15 19:47:21
【问题描述】:
我有一个 THREE.Group();在我的场景和运行时,我想向这个组添加更多内容,但它没有得到更新或更好,我看不到我在运行时添加的精灵。精灵在组中但未渲染。
如何更新 THREE.Group();?
用于澄清我的问题的示例代码。我知道不是真的在跑步。
var systemGroup = new THREE.Group();
init();
animate();
function init() {
//add something to systemGroup like multiple meshes
systemGroup.add(mesh);
scene.add(systemGroup);
}
function render() {
scene.updateMatrixWorld();
renderer.render( scene, camera );
}
function animate() {
requestAnimationFrame( animate );
render();
}
function addMore(x,y,z){
var map = THREE.ImageUtils.loadTexture( "sprite.png" );
var material = new THREE.SpriteMaterial( { map: map, color: 0xffffff, fog: true } );
var sprite = new THREE.Sprite( material );
sprite.position.set(x,y,z);
systemGroup.add(sprite);
//Here how do i update the group so that the mesh is in the scene?
}
谢谢。
【问题讨论】:
标签: three.js