浏览代码

emitter: fix wrong velocity value computation in the particles.

legacy
Sam Hocevar sam 13 年前
父节点
当前提交
f4841d64ec
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. +4
    -2
      src/emitter.cpp

+ 4
- 2
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];


正在加载...
取消
保存