@@ -3029,7 +3029,6 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
3029
3029
{
3030
3030
LocalPlayer *player = client->getEnv ().getLocalPlayer ();
3031
3031
3032
- const v3f head_position = camera->getHeadPosition ();
3033
3032
const v3f camera_direction = camera->getDirection ();
3034
3033
const v3s16 camera_offset = camera->getOffset ();
3035
3034
@@ -3045,13 +3044,22 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
3045
3044
3046
3045
core::line3d<f32> shootline;
3047
3046
3048
- if (camera->getCameraMode () != CAMERA_MODE_THIRD_FRONT) {
3049
- shootline = core::line3d<f32>(head_position,
3050
- head_position + camera_direction * BS * d);
3051
- } else {
3047
+ switch (camera->getCameraMode ()) {
3048
+ case CAMERA_MODE_FIRST:
3049
+ // Shoot from camera position, with bobbing
3050
+ shootline.start = camera->getPosition ();
3051
+ break ;
3052
+ case CAMERA_MODE_THIRD:
3053
+ // Shoot from player head, no bobbing
3054
+ shootline.start = camera->getHeadPosition ();
3055
+ break ;
3056
+ case CAMERA_MODE_THIRD_FRONT:
3057
+ shootline.start = camera->getHeadPosition ();
3052
3058
// prevent player pointing anything in front-view
3053
- shootline = core::line3d<f32>(head_position, head_position);
3059
+ d = 0 ;
3060
+ break ;
3054
3061
}
3062
+ shootline.end = shootline.start + camera_direction * BS * d;
3055
3063
3056
3064
#ifdef HAVE_TOUCHSCREENGUI
3057
3065
0 commit comments