I'm attempting to assign velocity and an origin to a particle using threes, but I'm having trouble adding the origin.
function getOrigin() {
return new THREE.Vector3(Weapon.vehicle.position.x, Weapon.vehicle.position.y, Weapon.vehicle.position.z);
}
function start() {
time = Weapon.time;
done = false;
var origin = getOrigin();
particles = new THREE.Geometry();
var pMaterial = new THREE.ParticleBasicMaterial({
color: Weapon.explosion.color,
size: Weapon.explosion.size,
map: THREE.ImageUtils.loadTexture("img/particula.png"),
blending: THREE.AdditiveBlending,
transparent: true
});
for(var p = 0; p < particleCount; p++) {
// create a particle with random
// position values, -250 -> 250
var pX = (Math.random() * Weapon.vehicle.size.x) - (Weapon.vehicle.size.x / 2),
pY = (Math.random() * Weapon.vehicle.size.y) - (Weapon.vehicle.size.y / 2),
pZ = (Math.random() * Weapon.vehicle.size.z) - (Weapon.vehicle.size.z / 2),
particle = new THREE.Vector3(pX, pY, pZ);
// create a velocity vector
particle.velocity = particle.clone();
particle.addSelf(origin);
// add it to the geometry
particles.vertices.push(particle);
}
// create the particle system
particleSystem = new THREE.ParticleSystem(particles, pMaterial);
particleSystem.sortParticles = true;
scene.add(particleSystem);
}
The line `particle.addSelf(origin);` is causing an issue as it's showing an undefined function. This was working fine with an older version of threes, but after upgrading from r52 to r67, I'm encountering multiple problems. If you have any insights or suggestions, your help would be greatly appreciated.