medfall

A super great game engine
Log | Files | Refs

commit 61cfc151f29bd08d236f024a56b3a4e0b4a3f821
parent bc7a775cbd1490a8a3fb8779f837be1ad316a005
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Aug 22 18:22:10 +0100

Code that should have been in the physics rewrite commit.

Diffstat:
hm.cc | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hm.cc b/hm.cc @@ -289,11 +289,6 @@ GAME_FRAME( game_frame ) { game->pos = lerp( step_down_start, step_down_t, step_down_end ); game->on_ground = step_down_hit; } - - if( game->on_ground ) { - // move up 1mm so float imprecision doesn't make us fall through the world - game->pos.z += 0.001f; - } } if( !game->on_ground ) { @@ -308,7 +303,7 @@ GAME_FRAME( game_frame ) { if( hit ) { // TODO: check normal is flat enough, otherwise stay in the air game->on_ground = true; - game->pos += game->velocity * t * remaining_t + v3( 0, 0, 0.001 ); + game->pos += game->velocity * t * remaining_t; // TODO: truncate velocity game->velocity.z = 0; @@ -319,6 +314,11 @@ GAME_FRAME( game_frame ) { remaining_t = 0; } } + + if( game->on_ground ) { + // move up 1mm so float imprecision doesn't make us fall through the world + game->pos.z += 0.001f; + } } #else const float speed = 100.0f;