diff options
author | Kahrl <kahrl@gmx.net> | 2011-09-20 18:25:29 +0200 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2011-09-20 18:25:29 +0200 |
commit | 6599002149f58c03b807cd1378ec17278dbdc09d (patch) | |
tree | d9f7ed6f77d8d42d40342ce1c30a1d02754745a5 /src | |
parent | cbd2bcf102bd338ba1d97ad54bd257913f4dcd36 (diff) | |
download | minetest-6599002149f58c03b807cd1378ec17278dbdc09d.tar.gz minetest-6599002149f58c03b807cd1378ec17278dbdc09d.tar.bz2 minetest-6599002149f58c03b807cd1378ec17278dbdc09d.zip |
fix a numerical problem, but tool is still jittery
Diffstat (limited to 'src')
-rw-r--r-- | src/camera.cpp | 3 | ||||
-rw-r--r-- | src/player.h | 11 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index 316a3f70a..4b0f968a4 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -151,8 +151,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize) m_playernode->updateAbsolutePosition(); // Set head node transformation - v3f eye_offset = player->getEyePosition() - player->getPosition(); - m_headnode->setPosition(eye_offset); + m_headnode->setPosition(player->getEyeOffset()); m_headnode->setRotation(v3f(player->getPitch(), 0, 0)); m_headnode->updateAbsolutePosition(); diff --git a/src/player.h b/src/player.h index ad0fb5ff9..350b85e1b 100644 --- a/src/player.h +++ b/src/player.h @@ -67,12 +67,17 @@ public: return floatToInt(m_position + v3f(0,BS+BS/2,0), BS); } - v3f getEyePosition() + v3f getEyeOffset() { // This is at the height of the eyes of the current figure - // return m_position + v3f(0, BS+BS/2, 0); + // return v3f(0, BS+BS/2, 0); // This is more like in minecraft - return m_position + v3f(0,BS+(5*BS)/8,0); + return v3f(0,BS+(5*BS)/8,0); + } + + v3f getEyePosition() + { + return m_position + getEyeOffset(); } virtual void setPosition(const v3f &position) |