@@ -2961,10 +2961,15 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
2961
2961
hlist ? hlist->getItem (0 ).getDefinition (itemdef_manager) : itemdef_manager->get (" " );
2962
2962
2963
2963
v3f player_position = player->getPosition ();
2964
+ v3f player_eye_position = player->getEyePosition ();
2964
2965
v3f camera_position = camera->getPosition ();
2965
2966
v3f camera_direction = camera->getDirection ();
2966
2967
v3s16 camera_offset = camera->getOffset ();
2967
2968
2969
+ if (camera->getCameraMode () == CAMERA_MODE_FIRST)
2970
+ player_eye_position += player->eye_offset_first ;
2971
+ else
2972
+ player_eye_position += player->eye_offset_third ;
2968
2973
2969
2974
/*
2970
2975
Calculate what block is the crosshair pointing to
@@ -2981,11 +2986,11 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
2981
2986
core::line3d<f32> shootline;
2982
2987
2983
2988
if (camera->getCameraMode () != CAMERA_MODE_THIRD_FRONT) {
2984
- shootline = core::line3d<f32>(camera_position ,
2985
- camera_position + camera_direction * BS * d);
2989
+ shootline = core::line3d<f32>(player_eye_position ,
2990
+ player_eye_position + camera_direction * BS * d);
2986
2991
} else {
2987
2992
// prevent player pointing anything in front-view
2988
- shootline = core::line3d<f32>(camera_position,camera_position);
2993
+ shootline = core::line3d<f32>(camera_position, camera_position);
2989
2994
}
2990
2995
2991
2996
#ifdef HAVE_TOUCHSCREENGUI
0 commit comments