X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_common.c;h=e0a77769d03e4019eda3bb6fd55c02610ef9442f;hb=53597f45307d8a2120e3a0bbe71797b216e8750b;hp=270f40e5140174179b956f41a515e3cebc3d9ecd;hpb=f48c3935c01da796b7ecb011a42d6576788b7648;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_common.c b/player_common.c index 270f40e..e0a7776 100644 --- a/player_common.c +++ b/player_common.c @@ -40,8 +40,10 @@ VG_STATIC void player_camera_portal_correction( player_instance *player ) q_mulv( player->gate_waiting->q[1], (v3f){0.0f,0.0f,1.0f}, plane ); plane[3] = v3_dot( plane, player->gate_waiting->co[1] ); + f32 pol = v3_dot( player->cam.pos, plane ) - plane[3]; + /* check camera polarity */ - if( v3_dot( player->cam.pos, plane ) < plane[3] ) { + if( (pol < 0.0f) || (pol > 5.0f) ) { vg_success( "Plane cleared\n" ); player_apply_transport_to_cam( player->gate_waiting->transport ); player->gate_waiting = NULL; @@ -71,7 +73,9 @@ VG_STATIC void player__cam_iterate( player_instance *player ){ else{ v3_copy( (v3f){-0.15f,1.75f,0.0f}, cc->fpv_viewpoint ); v3_copy( (v3f){0.0f,0.0f,0.0f}, cc->fpv_offset ); - v3_copy( (v3f){0.0f,1.4f,0.0f}, cc->tpv_offset ); + + f32 h = vg_lerpf( 0.4f, 1.4f, k_cam_height ); + v3_copy( (v3f){0.0f,h,0.0f}, cc->tpv_offset ); v3_add( cc->tpv_offset_extra, cc->tpv_offset, cc->tpv_offset ); } @@ -201,11 +205,13 @@ VG_STATIC void player__cam_iterate( player_instance *player ){ v3_muladds( tpv_offset, cc->cam_velocity_smooth, -0.025f, tpv_offset ); v3_add( tpv_origin, tpv_offset, tpv_pos ); +#if 0 f32 t; v3f n; if( spherecast_world( world_current_instance(), tpv_origin, tpv_pos, 0.2f, &t, n ) != -1 ){ v3_lerp( tpv_origin, tpv_pos, t, tpv_pos ); } +#endif /* * Blend cameras