FIx crash in LOD
This commit is contained in:
parent
78b21eb840
commit
5a07fd0fa4
@ -80,7 +80,11 @@ int LODNode::getLevel()
|
|||||||
if (camera == NULL)
|
if (camera == NULL)
|
||||||
return (int)m_detail.size() - 1;
|
return (int)m_detail.size() - 1;
|
||||||
AbstractKart* kart = camera->getKart();
|
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 =
|
const int dist =
|
||||||
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));
|
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));
|
||||||
|
Loading…
Reference in New Issue
Block a user