diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.cpp b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.cpp index e11902e0..075e113f 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.cpp +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.cpp @@ -42,31 +42,10 @@ namespace SHADE , { SHCollision::CapsuleVsSphere, SHCollision::CapsuleVsConvex, SHCollision::CapsuleVsCapsule } // Capsule }; - const bool SHCollisionDispatcher::collisionTable[NUM_TYPES][NUM_TYPES] - { - /* S ST K KT D DT */ - /* S */ { false, false, false, true, true, true } - , /* ST */ { false, false, true, true, true, true } - , /* K */ { false, true, false, true, true, true } - , /* KT */ { true, true, true, true, true, true } - , /* D */ { true, true, true, true, true, true } - , /* DT */ { true, true, true, true, true, true } - }; - /*-----------------------------------------------------------------------------------*/ /* Public Member Functions Definitions */ /*-----------------------------------------------------------------------------------*/ - bool SHCollisionDispatcher::ShouldCollide(const SHCollisionShape& A, const SHCollisionShape& B) noexcept - { - // Filter through collision table - const int TYPE_A = SHUtilities::ConvertEnum(A.GetType()) + A.IsTrigger() ? TYPE_OFFSET : 0; - const int TYPE_B = SHUtilities::ConvertEnum(B.GetType()) + B.IsTrigger() ? TYPE_OFFSET : 0; - - if (!collisionTable[TYPE_A][TYPE_B]) - return false; - } - bool SHCollisionDispatcher::Collide(SHManifold& manifold, const SHCollisionShape& A, const SHCollisionShape& B) noexcept { const int TYPE_A = SHUtilities::ConvertEnum(A.GetType()); diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.h b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.h index 2dea7f1d..1df84da0 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.h +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHCollisionDispatch.h @@ -31,18 +31,6 @@ namespace SHADE /* Member Functions */ /*---------------------------------------------------------------------------------*/ - /** - * @brief - * Filters the collision through the collision table and layer matching. - * @param A - * A Collision Shape. - * @param B - * A Collision Shape. - * @return - * True if both shapes should be tested for collision. - */ - static bool ShouldCollide (const SHCollisionShape& A, const SHCollisionShape& B) noexcept; - static bool Collide (SHManifold& manifold, const SHCollisionShape& A, const SHCollisionShape& B) noexcept; static bool Collide (const SHCollisionShape& A, const SHCollisionShape& B) noexcept; @@ -54,33 +42,14 @@ namespace SHADE using ManifoldCollide = bool(*)(SHManifold&, const SHCollisionShape& A, const SHCollisionShape& B); using TriggerCollide = bool(*)(const SHCollisionShape& A, const SHCollisionShape& B); - enum class Types - { - STATIC - , KINEMATIC - , DYNAMIC - , STATIC_TRIGGER - , KINEMATIC_TRIGGER - , DYNAMIC_TRIGGER - - , COUNT - }; - /*---------------------------------------------------------------------------------*/ /* Data Members */ /*---------------------------------------------------------------------------------*/ - // Read the Types enum class, then see where it's used and it'll make sense - static constexpr int TYPE_OFFSET = 3; - static constexpr int NUM_SHAPES = static_cast(SHCollisionShape::Type::COUNT); - static constexpr int NUM_TYPES = static_cast(Types::COUNT); static const ManifoldCollide manifoldCollide [NUM_SHAPES][NUM_SHAPES]; static const TriggerCollide triggerCollide [NUM_SHAPES][NUM_SHAPES]; - - static const bool collisionTable [NUM_TYPES][NUM_TYPES]; - }; diff --git a/SHADE_Engine/src/Physics/Dynamics/SHRigidBody.cpp b/SHADE_Engine/src/Physics/Dynamics/SHRigidBody.cpp index 1de9e543..bdaaf230 100644 --- a/SHADE_Engine/src/Physics/Dynamics/SHRigidBody.cpp +++ b/SHADE_Engine/src/Physics/Dynamics/SHRigidBody.cpp @@ -643,7 +643,7 @@ namespace SHADE // Compute world centroid worldCentroid = (R * localCentroid) + motionState.position; - if (bodyType == Type::STATIC) + if (bodyType != Type::DYNAMIC) return; // Compute world inertia