diff --git a/src/graphics/lod_node.cpp b/src/graphics/lod_node.cpp index 1fea813a6..31ab6d731 100644 --- a/src/graphics/lod_node.cpp +++ b/src/graphics/lod_node.cpp @@ -80,7 +80,11 @@ int LODNode::getLevel() if (camera == NULL) return (int)m_detail.size() - 1; AbstractKart* kart = camera->getKart(); - const Vec3 &pos = kart->getFrontXYZ(); + // use kart position and not camera position when a kart is available, + // because for some effects the camera will be moved to various locations + // (for instance shadows), so using camera position for LOD may result + // in objects being culled when they shouldn't + const Vec3 &pos = (kart != NULL ? kart->getFrontXYZ() : camera->getCameraSceneNode()->getAbsolutePosition()); const int dist = (int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));