第一次使用three.js,我正在做一个非常简单的粒子动画,其中我映射了4种不同的纹理。目前一切都按预期工作,但是我无法弄清楚如何旋转粒子,以便它们以随机方向(倒立、侧着等)呈现。任何帮助将不胜感激!
您可以在此处查看我的进度:http://development.shapes.divshot.io/particles.html
以下是相关代码:
sprite1 = THREE.ImageUtils.loadTexture( "sprite1.png" );
sprite2 = THREE.ImageUtils.loadTexture( "sprite2.png" );
sprite3 = THREE.ImageUtils.loadTexture( "sprite3.png" );
sprite4 = THREE.ImageUtils.loadTexture( "sprite4.png" );
parameters = [ sprite1, sprite2, sprite3, sprite4];
for ( i = 0; i < parameters.length; i ++ ) {
sprite = parameters[i];
materials[i] = new THREE.PointCloudMaterial( { size: 45, map: sprite, depthTest: false, transparent : true} );
particles = new THREE.PointCloud( geometry, materials[i] );
particles.rotation.x = Math.random() * 60;
particles.rotation.y = Math.random() * 60;
particles.rotation.z = Math.random() * 60;
scene.add( particles );
}
使用 three.js r71