From f4841d64ecd49e47adf96afdc3155f3ebb72b3b4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 18 Aug 2011 06:44:38 +0000 Subject: [PATCH] emitter: fix wrong velocity value computation in the particles. --- src/emitter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/emitter.cpp b/src/emitter.cpp index 184924d9..4777ef75 100644 --- a/src/emitter.cpp +++ b/src/emitter.cpp @@ -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];