Better pointInPoly
This commit is contained in:
parent
87df259f48
commit
405d31ecfc
@ -138,11 +138,7 @@ void BattleGraph::findItemsOnGraphNodes()
|
|||||||
for (unsigned int j = 0; j < this->getNumNodes(); ++j)
|
for (unsigned int j = 0; j < this->getNumNodes(); ++j)
|
||||||
{
|
{
|
||||||
if (NavMesh::get()->getNavPoly(j).pointInPoly(xyz))
|
if (NavMesh::get()->getNavPoly(j).pointInPoly(xyz))
|
||||||
{
|
polygon = j;
|
||||||
float dist = xyz.getY() - NavMesh::get()->getCenterOfPoly(j).getY();
|
|
||||||
if (fabsf(dist) < 1.0f )
|
|
||||||
polygon = j;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polygon != BattleGraph::UNKNOWN_POLY)
|
if (polygon != BattleGraph::UNKNOWN_POLY)
|
||||||
|
@ -70,6 +70,10 @@ bool NavPoly::pointInPoly(const Vec3& p) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for vertical distance too
|
||||||
|
const float dist = p.getY() - m_center.getY();
|
||||||
|
if (fabsf(dist) > 1.0f )
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user