aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkilbith <jeanpatrick.guerrero@gmail.com>2017-03-31 21:57:08 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-03-31 22:00:05 +0200
commit529ba8002d686cdf004405e033fe7e95ea6cbacd (patch)
treeb948a5965259890115ddde278ca451dadd37f2f4 /src
parentcc1ff26c3f078cd11f309a7cb24b7921baef89b7 (diff)
downloadminetest-529ba8002d686cdf004405e033fe7e95ea6cbacd.tar.gz
minetest-529ba8002d686cdf004405e033fe7e95ea6cbacd.tar.bz2
minetest-529ba8002d686cdf004405e033fe7e95ea6cbacd.zip
Wieldmesh: Natural orientation depending on pitch (#5490)
Diffstat (limited to 'src')
-rw-r--r--src/camera.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index a7679e43a..d5c337fe8 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -404,9 +404,12 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
m_cameranode->setAspectRatio(m_aspect);
m_cameranode->setFOV(m_fov_y);
+ float wieldmesh_offset_Y = -35 + player->getPitch() * 0.05;
+ wieldmesh_offset_Y = rangelim(wieldmesh_offset_Y, -52, -32);
+
// Position the wielded item
//v3f wield_position = v3f(45, -35, 65);
- v3f wield_position = v3f(55, -35, 65);
+ v3f wield_position = v3f(55, wieldmesh_offset_Y, 65);
//v3f wield_rotation = v3f(-100, 120, -100);
v3f wield_rotation = v3f(-100, 120, -100);
wield_position.Y += fabs(m_wield_change_timer)*320 - 40;