Skip to content

Instantly share code, notes, and snippets.

@PilzAdam
Created January 20, 2013 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PilzAdam/4581577 to your computer and use it in GitHub Desktop.
Save PilzAdam/4581577 to your computer and use it in GitHub Desktop.
diff --git a/src/particles.cpp b/src/particles.cpp
index d49e333..9ca4aef 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -125,12 +125,16 @@ void Particle::step(float dtime, ClientEnvironment &env)
v3f p_pos = m_pos*BS;
v3f p_velocity = m_velocity*BS;
v3f p_acceleration = m_acceleration*BS;
- collisionMoveSimple(&env.getClientMap(), m_gamedef,
+ collisionMoveResult result = collisionMoveSimple(&env.getClientMap(),
+ m_gamedef,
BS*0.5, box,
0, dtime,
p_pos, p_velocity, p_acceleration);
m_pos = p_pos/BS;
- m_velocity = p_velocity/BS;
+ if(result.touching_ground)
+ m_velocity = v3f(0,0,0);
+ else
+ m_velocity = p_velocity/BS;
m_acceleration = p_acceleration/BS;
m_time += dtime;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment