medfall

A super great game engine
Log | Files | Refs

commit 6884f92a9555cf0d7bb5592dcac369d5edca6291
parent 2359ade12324fb16e9a4ee655179877535ebe106
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed Jul 26 22:55:34 +0300

EYE_HEIGHT

Diffstat:
hm.cc | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/hm.cc b/hm.cc @@ -22,6 +22,8 @@ #include "libs/lz4/lz4.h" +static const float EYE_HEIGHT = 1.8f; + static Socket sock; static u64 sid; static double last_connection_attempt = -5.0; // TODO @@ -314,7 +316,7 @@ GAME_FRAME( game_frame ) { terrain_update( &game->tm, game->pos ); - v3 eye_pos = game->pos + v3( 0, 0, 1.8f ); + v3 eye_pos = game->pos + v3( 0, 0, EYE_HEIGHT ); m4 P = m4_perspective( VERTICAL_FOV, get_aspect_ratio(), NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); m4 V = m4_view( forward, right, up, eye_pos ); m4 Vsky = m4_view( forward, right, up, v3( 0 ) ); @@ -352,7 +354,7 @@ GAME_FRAME( game_frame ) { float t; v3 normal; v3 seg_end = game->pos + 1024.0f * forward; - if( segment_vs_terrain( &game->tm, game->pos, seg_end, &t, &normal ) ) { + if( segment_vs_terrain( &game->tm, game->pos + v3( 0.0f, 0.0f, EYE_HEIGHT ), seg_end, &t, &normal ) ) { v3 impact = game->pos + forward * t; immediate_arrow( &imm, impact, normal, 16, v4( 1, 0, 0, 1 ) ); } @@ -365,7 +367,7 @@ GAME_FRAME( game_frame ) { if( input->keys[ KEY_F ] ) { Fireball * fireball = fireballs.acquire(); - fireball->pos = game->pos; + fireball->pos = game->pos + v3( 0.0f, 0.0f, EYE_HEIGHT ); fireball->velocity = 128.0f * forward; } @@ -514,8 +516,8 @@ GAME_FRAME( game_frame ) { for( const Player & player : players.elems ) { if( player.sid != sid ) { - v3 mins = player.pos - v3( 0.4f, 0.4f, 1.8f ); - v3 maxs = player.pos + v3( 0.4f, 0.4f, 0.1f ); + v3 mins = player.pos - v3( 0.4f, 0.4f, 0.0f ); + v3 maxs = player.pos + v3( 0.4f, 0.4f, EYE_HEIGHT + 0.1f ); immediate_aabb( &imm, mins, maxs, v4( 1, 1, 0, 1 ) ); } }