Browse Source

emitter: fix wrong velocity value computation in the particles.

legacy
Sam Hocevar sam 13 years ago
parent
commit
f4841d64ec
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      src/emitter.cpp

+ 4
- 2
src/emitter.cpp View File

@@ -54,8 +54,10 @@ void Emitter::TickGame(float deltams)
{
for (int i = 0; i < data->nparticles; i++)
{
data->velocities[i] = data->velocities[i] + deltams * data->gravity;
data->positions[i] = data->positions[i] + deltams * data->velocities[i];
vec3 oldvelocity = data->velocities[i];
data->velocities[i] += deltams * data->gravity;
data->positions[i] += deltams * 0.5f
* (oldvelocity + data->velocities[i]);
if (data->positions[i].y < -100)
{
data->particles[i] = data->particles[data->nparticles - 1];


Loading…
Cancel
Save