project2D/CollisionManager.cpp
/////////////////////////////////////////// TEST COLLISIONS ///////////////////////////////////////////
//--------------------------------------------------------------------------------------
// Test Collisions: Different function for different object types to check if colliding.
//
// Param:
//		pObject: The entity to check if its colliding.
//
// Returns:
//		Entity: The entity that is being collided with.
//--------------------------------------------------------------------------------------
TEST COLLISIONS
Test Collisions: Different function for different object types to check if colliding.

The entity to check if its colliding.

The entity that is being collided with.
TEST COLLISIONS Test Collisions : Different function for different object types to check if colliding . The entity to check if its colliding . The entity that is being collided with .
Entity* CollisionManager::TestBoxBoxCollision(Entity* pObject)
{
	for (int i = 0; i < m_CollisionList.size(); ++i)
	{
		if (pObject == m_CollisionList[i])
			continue;
		if (IsColliding(pObject, m_CollisionList[i]))
		{
			return m_CollisionList[i];
		}
	}
	return nullptr;
}
Entity * CollisionManager :: TestBoxBoxCollision ( Entity * pObject ) { for ( int i = 0 ; i < m_CollisionList . size ( ) ; ++ i ) { if ( pObject == m_CollisionList [ i ] ) continue ; if ( IsColliding ( pObject , m_CollisionList [ i ] ) ) { return m_CollisionList [ i ] ; } } return nullptr ; }
TEST COLLISIONS
Test Collisions: Different function for different object types to check if colliding.
TEST COLLISIONS Test Collisions : Different function for different object types to check if colliding .
// Return whats colliding if SAT IsCollding is true. // Calculate AABB of our two objects //Collider collider1 = pObject->GetCollider(); //collider1.m_TL += pObject->GetPosition(); //collider1.m_BR += pObject->GetPosition(); //Collider collider2 = m_CollisionList[i]->GetCollider(); //collider2.m_TL += m_CollisionList[i]->GetPosition(); //collider2.m_BR += m_CollisionList[i]->GetPosition(); //// Test if two AABBs are overlapping //if (collider1.m_BR > collider2.m_TL && collider1.m_TL < collider2.m_BR) //{ //	return m_CollisionList[i]; //}