]> git.lizzy.rs Git - minetest.git/blobdiff - src/content_cao.cpp
Fix rendering glitches when far from the center of the map
[minetest.git] / src / content_cao.cpp
index 840103cc74644f7406ae98e569258b4c7bdad3e7..84ec3e1430701014e3ee3791f958e558c50c1490 100644 (file)
@@ -1058,23 +1058,24 @@ class GenericCAO : public ClientActiveObject
                if(getParent() != NULL)
                        return;
 
+               v3s16 camera_offset = m_env->getCameraOffset();
                if(m_meshnode){
-                       m_meshnode->setPosition(pos_translator.vect_show);
+                       m_meshnode->setPosition(pos_translator.vect_show-intToFloat(camera_offset, BS));
                        v3f rot = m_meshnode->getRotation();
                        rot.Y = -m_yaw;
                        m_meshnode->setRotation(rot);
                }
                if(m_animated_meshnode){
-                       m_animated_meshnode->setPosition(pos_translator.vect_show);
+                       m_animated_meshnode->setPosition(pos_translator.vect_show-intToFloat(camera_offset, BS));
                        v3f rot = m_animated_meshnode->getRotation();
                        rot.Y = -m_yaw;
                        m_animated_meshnode->setRotation(rot);
                }
                if(m_spritenode){
-                       m_spritenode->setPosition(pos_translator.vect_show);
+                       m_spritenode->setPosition(pos_translator.vect_show-intToFloat(camera_offset, BS));
                }
        }
-
+       
        void step(float dtime, ClientEnvironment *env)
        {
                if(m_visuals_expired && m_smgr && m_irr){