mirror of
https://github.com/minetest/minetest.git
synced 2024-12-28 08:57:30 +01:00
Camera: Fix shootline line offsets II (#9730)
This commit is contained in:
parent
6ba44d7452
commit
ce5b0932f8
@ -3029,7 +3029,6 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
|
||||
{
|
||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||
|
||||
const v3f head_position = camera->getHeadPosition();
|
||||
const v3f camera_direction = camera->getDirection();
|
||||
const v3s16 camera_offset = camera->getOffset();
|
||||
|
||||
@ -3045,13 +3044,22 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
|
||||
|
||||
core::line3d<f32> shootline;
|
||||
|
||||
if (camera->getCameraMode() != CAMERA_MODE_THIRD_FRONT) {
|
||||
shootline = core::line3d<f32>(head_position,
|
||||
head_position + camera_direction * BS * d);
|
||||
} else {
|
||||
switch (camera->getCameraMode()) {
|
||||
case CAMERA_MODE_FIRST:
|
||||
// Shoot from camera position, with bobbing
|
||||
shootline.start = camera->getPosition();
|
||||
break;
|
||||
case CAMERA_MODE_THIRD:
|
||||
// Shoot from player head, no bobbing
|
||||
shootline.start = camera->getHeadPosition();
|
||||
break;
|
||||
case CAMERA_MODE_THIRD_FRONT:
|
||||
shootline.start = camera->getHeadPosition();
|
||||
// prevent player pointing anything in front-view
|
||||
shootline = core::line3d<f32>(head_position, head_position);
|
||||
d = 0;
|
||||
break;
|
||||
}
|
||||
shootline.end = shootline.start + camera_direction * BS * d;
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user