Adding more bounds overlap tests.

This commit is contained in:
Бранимир Караџић
2019-02-05 23:09:57 -08:00
parent 3118ccfc07
commit cefce11fe4
2 changed files with 49 additions and 2 deletions

View File

@@ -1542,7 +1542,20 @@ bool overlap(const Triangle& _triangle, const Disk& _disk)
bool overlap(const Triangle& _triangle, const Obb& _obb)
{
BX_UNUSED(_triangle, _obb);
return false;
Srt srt = toSrt(_obb.mtx);
const Quaternion invRotation = invert(srt.rotation);
const Triangle triangle =
{
mul(sub(_triangle.v0, srt.translation), invRotation),
mul(sub(_triangle.v1, srt.translation), invRotation),
mul(sub(_triangle.v2, srt.translation), invRotation),
};
Aabb aabb;
toAabb(aabb, srt.scale);
return overlap(triangle, aabb);
}