fix a numerical problem, but tool is still jittery
authorKahrl <kahrl@gmx.net>
Tue, 20 Sep 2011 16:25:29 +0000 (18:25 +0200)
committerKahrl <kahrl@gmx.net>
Tue, 20 Sep 2011 16:25:29 +0000 (18:25 +0200)
src/camera.cpp
src/player.h

index 316a3f70a4df1225809921912ff809b68cdfeb7c..4b0f968a42e45fcd51e419428388b68521fb65fd 100644 (file)
@@ -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();
 
index ad0fb5ff91f19af69024330a0672a77a30500fcc..350b85e1ba5ba46a547729b417713a219d05200f 100644 (file)
@@ -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)