Added automatic bounding box expansion, fixed several bugs in the aabb calculations and removed node OBBs (#2871)

Merge pull request #2871 from aws-lumberyard-dev/jillich/EmfxAabbImprovements
This commit is contained in:
Benjamin Jillich
2021-08-09 01:19:42 -07:00
committed by GitHub
45 changed files with 341 additions and 1916 deletions
@@ -83,10 +83,10 @@ namespace AZ
// Update RenderActorInstance world bounding box
// The bounding box is moving with the actor instance.
// The entity and actor transforms are kept in sync already.
m_worldAABB = AZ::Aabb::CreateFromMinMax(m_actorInstance->GetAABB().GetMin(), m_actorInstance->GetAABB().GetMax());
m_worldAABB = m_actorInstance->GetAabb();
// Update RenderActorInstance local bounding box
// NB: computing the local bbox from the world bbox makes the local bbox artifically larger than it should be
// NB: computing the local bbox from the world bbox makes the local bbox artificially larger than it should be
// instead EMFX should support getting the local bbox from the actor instance directly
m_localAABB = m_worldAABB.GetTransformedAabb(m_transformInterface->GetWorldTM().GetInverse());
@@ -107,9 +107,8 @@ namespace AZ
{
if (debugOptions.m_drawAABB)
{
const MCore::AABB emfxAabb = m_actorInstance->GetAABB();
const AZ::Aabb azAabb = AZ::Aabb::CreateFromMinMax(emfxAabb.GetMin(), emfxAabb.GetMax());
auxGeom->DrawAabb(azAabb, AZ::Color(0.0f, 1.0f, 1.0f, 1.0f), RPI::AuxGeomDraw::DrawStyle::Line);
const AZ::Aabb& aabb = m_actorInstance->GetAabb();
auxGeom->DrawAabb(aabb, AZ::Color(0.0f, 1.0f, 1.0f, 1.0f), RPI::AuxGeomDraw::DrawStyle::Line);
}
if (debugOptions.m_drawSkeleton)