Beispiel #1
0
bool CCollider::CollideWith(CCollider& other, const double dt)
{
	if (!this->m_active || !other.GetActive()) // If one of the collider does not collide, no collision will occur, hence false
	{
		return false;
	}

	if (this->m_type == CT_AABB)
	{
		if (other.GetType() == CT_AABB)
		{
			// AABB - AABB collision
			return AABBCollision(other, dt);
		}
		else if (other.GetType() == CT_DIST)
		{
			// AABB - Dist collision
			return AABBCollision(other, dt); // Use AABB - AABB collision
		}
	}
	else if (this->m_type == CT_DIST)
	{
		if (other.GetType() == CT_AABB)
		{
			// Dist - AABB collision
			return AABBCollision(other, dt); // Use AABB - AABB collision
		}
		else if (other.GetType() == CT_DIST)
		{
			// Dist - Dist collision
			return distCollision(other, dt);
		}
	}
}