Hi All,
I’m trying to figure out a way to Scale the X position of my vertices using a ParticleSystem. I’ve pasted my code below, for reference of my particle system.
var particleSystem;
var particle_system_geometry ;
function createTheVoid()
{
var numStars = 1000;
var PI2 = Math.PI * 2;
particle_system_geometry = new THREE.Geometry();
particle_system_geometry.verticesNeedUpdate = true;
var particleMap = new THREE.TextureLoader().load( "./images/star.png" );
var particle = new THREE.PointsMaterial({map:particleMap, color: 0xffffff, transparent: true, opacity: 1,
blending: THREE.AdditiveBlending});
for (i = 0; i < numStars; i++)
{
var vectorThree = new THREE.Vector3(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random()
* 2 - 1);
particle_system_geometry.vertices.push(vectorThree);
particle_system_geometry.vertices[i].multiplyScalar(Math.random() * 10 + 450);
}
particleSystem = new THREE.Points(particle_system_geometry, particle);
particleSystem.geometry.verticesNeedUpdate = true;
scene.add(particleSystem);
scaleParticles();
}
createTheVoid();
function scaleParticles()
{
var stars = particleSystem.geometry.vertices;
for(var i = 0; i < stars.length; i++)
{
var star = stars[i];
// statement below doesn't do anything, why is that?.
star.scale(2, 0, 0);
}
}
Thanks,
- Abel