Game Development Community

Changing a particle position

by kc_0045 · in Torque Game Engine · 08/24/2004 (8:46 pm) · 4 replies

Hello, im trying to set up a wind system that well blow particles, i know there is all ready one in torque but i want 2(for testing somthing :D) but anyway the one thing i cant figure out is how to i change the pos of each particle every tick? what function would that be in? i was thinking

void PEngine::updateSingleParticle(Particle* particle, ParticleEmitter &emitter, const U32 ms)

but im not sure...and how do i change the x,y,z posistion of each single particle?

thanks in advanced. and sorry if its hard to read im not good at english grammer :D

#1
08/28/2004 (11:33 am)
You set the xyz position to what it needs to be. Perhaps add velocity to it each update? If you're writing your own particle engine it's unlikely you're going to take the same structure as the other one...For comparison you could look at the TSE particle system, which is a rewrite.
#2
08/28/2004 (12:16 pm)
No im not going to, im just trying to add some extra things to the particle engine, but say i wanted to add 0.1 to the z posistion every step, were would i put that and how? im still rather new to the c++ with torque :D
#3
09/04/2004 (1:36 pm)
Point3F a = particle->acc;
   a -= particle->vel        * particle->dataBlock->dragCoefficient;
   a -= ParticleEngine::windVelocity * particle->dataBlock->windCoefficient;
   a += Point3F(0, 0, -9.81) * particle->dataBlock->gravityCoefficient;

   particle->vel += a * t;
   particle->pos += particle->vel * t;

This is the code which updates acceleration, velocity, and position. Tweak it as you see fit! :)
#4
09/04/2004 (3:00 pm)
Ah ok thanks :D thats what i was looking for :D