Example #1
0
	Collision Collider::IsColliding(const Collider& other) {
		Collision col;
		
		if (m_type == ColliderType::AABB && other.m_type == ColliderType::AABB)
			col =  AABBvsAABB(other);
		else if (m_type == ColliderType::Circle && other.m_type == ColliderType::Circle)
			col = CirclevsCircle(other);
		else if ((m_type == ColliderType::Circle && other.m_type == ColliderType::AABB) ||
				 (m_type == ColliderType::AABB && other.m_type == ColliderType::Circle))
			col = AABBvsCircle(other);

		return col;
	}
void RigidBody::CheckCollision(RigidBody* actor)
{
	ShapeType _id = actor->m_shapeID;

	switch (m_shapeID)
	{
		case SPHERE:
		{
			 switch (_id)
			 {
			 case PLANE:
			   SPHEREvsPLANE(actor);
			   break;

			 case SPHERE:
			   SPHEREvsSPHERE(actor);
			   break;

			 case BOX:
				 SPHEREvsAABB(actor);
			   break;
			 }
		}
		break;

		case BOX:
		{
			switch (_id)
			{
			case PLANE:
				AABBvsPLANE(actor);
				break;

			case SPHERE:
				AABBvsSPHERE(actor);
				break;

			case BOX:
				AABBvsAABB(actor);
				break;
			}
		}
			break;

		case PLANE:
			{
				switch (_id)
				{
				case PLANE:
					break;

				case SPHERE:
					break;

				case BOX:
					break;
				}
			}
			break;

	default:
		std::cout << "Dont recognise collison type";
		break;

		
	}
}