Adding more bounds overlap tests.
This commit is contained in:
parent
3118ccfc07
commit
cefce11fe4
@ -1308,6 +1308,40 @@ public:
|
||||
dde.draw(diskB);
|
||||
}
|
||||
|
||||
{
|
||||
Triangle triangleA =
|
||||
{
|
||||
{ px-0.4f, py+0.0f, pz-0.4f },
|
||||
{ px+0.0f, py-0.3f, pz-0.5f },
|
||||
{ px+0.0f, py+0.5f, pz+0.3f },
|
||||
};
|
||||
|
||||
translate(triangleA, {kStepX*5.0f, 0.0f, kStepZ*2.0f});
|
||||
|
||||
Obb obbB;
|
||||
bx::mtxSRT(obbB.mtx
|
||||
, 1.0f
|
||||
, 0.25f
|
||||
, 0.25f
|
||||
, bx::toRad(10.0f)
|
||||
, bx::toRad(30.0f)
|
||||
, bx::toRad(70.0f)
|
||||
, xx+kStepX*5.0f
|
||||
, yy
|
||||
, zz+kStepZ*2.0f
|
||||
);
|
||||
|
||||
olp = overlap(triangleA, obbB);
|
||||
|
||||
dde.setColor(olp ? kOverlapA : 0xffffffff);
|
||||
dde.setWireframe(false);
|
||||
dde.draw(triangleA);
|
||||
|
||||
dde.setColor(olp ? kOverlapB : 0xffffffff);
|
||||
dde.setWireframe(true);
|
||||
dde.draw(obbB);
|
||||
}
|
||||
|
||||
// Capsule ---
|
||||
{
|
||||
Capsule capsuleA =
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user