2016-06-24 20:09:38 +00:00
|
|
|
#include "CCollisionSurface.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
CCollisionSurface::CCollisionSurface(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c, u32 flags)
|
|
|
|
: x0_a(a),
|
|
|
|
xc_b(b),
|
|
|
|
x18_c(c),
|
|
|
|
x24_flags(flags)
|
|
|
|
{
|
|
|
|
}
|
2016-12-26 07:58:44 +00:00
|
|
|
|
|
|
|
zeus::CVector3f CCollisionSurface::GetNormal() const
|
|
|
|
{
|
2017-12-09 05:17:51 +00:00
|
|
|
zeus::CVector3f v1 = (xc_b - x0_a).cross(x18_c - x0_a);
|
|
|
|
return zeus::CUnitVector3f(v1, true);
|
2016-12-26 07:58:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CPlane CCollisionSurface::GetPlane() const
|
|
|
|
{
|
|
|
|
zeus::CVector3f norm = GetNormal();
|
|
|
|
return {norm, norm.dot(x0_a)};
|
|
|
|
}
|
|
|
|
|
2016-06-24 20:09:38 +00:00
|
|
|
}
|