@@ -3029,16 +3029,9 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
3029
3029
{
3030
3030
LocalPlayer *player = client->getEnv ().getLocalPlayer ();
3031
3031
3032
- v3f player_position = player->getPosition ();
3033
- v3f player_eye_position = player->getEyePosition ();
3034
- v3f camera_position = camera->getPosition ();
3035
- v3f camera_direction = camera->getDirection ();
3036
- v3s16 camera_offset = camera->getOffset ();
3037
-
3038
- if (camera->getCameraMode () == CAMERA_MODE_FIRST)
3039
- player_eye_position += player->eye_offset_first ;
3040
- else
3041
- player_eye_position += player->eye_offset_third ;
3032
+ const v3f head_position = camera->getHeadPosition ();
3033
+ const v3f camera_direction = camera->getDirection ();
3034
+ const v3s16 camera_offset = camera->getOffset ();
3042
3035
3043
3036
/*
3044
3037
Calculate what block is the crosshair pointing to
@@ -3053,11 +3046,11 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
3053
3046
core::line3d<f32> shootline;
3054
3047
3055
3048
if (camera->getCameraMode () != CAMERA_MODE_THIRD_FRONT) {
3056
- shootline = core::line3d<f32>(player_eye_position ,
3057
- player_eye_position + camera_direction * BS * d);
3049
+ shootline = core::line3d<f32>(head_position ,
3050
+ head_position + camera_direction * BS * d);
3058
3051
} else {
3059
3052
// prevent player pointing anything in front-view
3060
- shootline = core::line3d<f32>(camera_position, camera_position );
3053
+ shootline = core::line3d<f32>(head_position, head_position );
3061
3054
}
3062
3055
3063
3056
#ifdef HAVE_TOUCHSCREENGUI
@@ -3145,6 +3138,7 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
3145
3138
} else if (pointed.type == POINTEDTHING_NODE) {
3146
3139
handlePointingAtNode (pointed, selected_item, hand_item, dtime);
3147
3140
} else if (pointed.type == POINTEDTHING_OBJECT) {
3141
+ v3f player_position = player->getPosition ();
3148
3142
handlePointingAtObject (pointed, tool_item, player_position, show_debug);
3149
3143
} else if (input->getLeftState ()) {
3150
3144
// When button is held down in air, show continuous animation
0 commit comments