Peds, mission switcher & fixes

This commit is contained in:
eray orçunus
2020-06-13 23:39:14 +03:00
parent f78f707935
commit db6110e996
10 changed files with 838 additions and 186 deletions

View File

@@ -1801,6 +1801,21 @@ CColSphere::Set(float radius, const CVector &center, uint8 surf, uint8 piece)
this->piece = piece;
}
bool
CColSphere::IntersectRay(CVector const& from, CVector const& dir, CVector &entry, CVector &exit)
{
CVector distToCenter = from - center;
float distToTouchSqr = distToCenter.MagnitudeSqr() - sq(radius);
float root1, root2;
if (!CGeneral::SolveQuadratic(1.0f, DotProduct(distToCenter, dir) * 2.f, distToTouchSqr, root1, root2))
return false;
entry = from + dir * root1;
exit = from + dir * root2;
return true;
}
void
CColBox::Set(const CVector &min, const CVector &max, uint8 surf, uint8 piece)
{