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
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
About the author
#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
This is the code which updates acceleration, velocity, and position. Tweak it as you see fit! :)
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
Associate Ben Garney