mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-23 00:01:49 +01:00
Fix some Collision NaN/inf's
This commit is contained in:
parent
e9054f2980
commit
2b269ff1c0
@ -477,8 +477,16 @@ CCollision::TestLineTriangle(const CColLine &line, const CompressedVector *verts
|
|||||||
if(plane.CalcPoint(line.p0) * plane.CalcPoint(line.p1) > 0.0f)
|
if(plane.CalcPoint(line.p0) * plane.CalcPoint(line.p1) > 0.0f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
float p0dist = DotProduct(line.p1 - line.p0, normal);
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
// line lines in the plane, assume no collision
|
||||||
|
if (p0dist == 0.0f)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// intersection parameter on line
|
// intersection parameter on line
|
||||||
t = -plane.CalcPoint(line.p0) / DotProduct(line.p1 - line.p0, normal);
|
t = -plane.CalcPoint(line.p0) / p0dist;
|
||||||
// find point of intersection
|
// find point of intersection
|
||||||
CVector p = line.p0 + (line.p1-line.p0)*t;
|
CVector p = line.p0 + (line.p1-line.p0)*t;
|
||||||
|
|
||||||
@ -1286,8 +1294,17 @@ CCollision::ProcessLineTriangle(const CColLine &line,
|
|||||||
if(plane.CalcPoint(line.p0) * plane.CalcPoint(line.p1) > 0.0f)
|
if(plane.CalcPoint(line.p0) * plane.CalcPoint(line.p1) > 0.0f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
float p0dist = DotProduct(line.p1 - line.p0, normal);
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
// line lines in the plane, assume no collision
|
||||||
|
if (p0dist == 0.0f)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// intersection parameter on line
|
// intersection parameter on line
|
||||||
t = -plane.CalcPoint(line.p0) / DotProduct(line.p1 - line.p0, normal);
|
t = -plane.CalcPoint(line.p0) / p0dist;
|
||||||
|
|
||||||
// early out if we're beyond the mindist
|
// early out if we're beyond the mindist
|
||||||
if(t >= mindist)
|
if(t >= mindist)
|
||||||
return false;
|
return false;
|
||||||
|
@ -431,10 +431,10 @@ CWorld::ProcessVerticalLineSector(CSector §or, const CColLine &line, CColPoi
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist,
|
CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &mindist,
|
||||||
CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly)
|
CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly)
|
||||||
{
|
{
|
||||||
float mindist = dist;
|
float dist = mindist;
|
||||||
CPtrNode *node;
|
CPtrNode *node;
|
||||||
CEntity *e;
|
CEntity *e;
|
||||||
CColModel *colmodel;
|
CColModel *colmodel;
|
||||||
@ -451,8 +451,8 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mindist < dist) {
|
if(dist < mindist) {
|
||||||
dist = mindist;
|
mindist = dist;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user