Example #1
0
IntersectData Collider::Intersect(const Collider& other) const
{
    if(m_type == TYPE_SPHERE && other.GetType() == TYPE_SPHERE)
    {
        BoundingSphere* self = (BoundingSphere*)this;
        return self->IntersectBoundingSphere((BoundingSphere&)other);
    }

    std::cerr << "Error: Collisions not implemented between specified "
              << "colliders." << std::endl;
    exit(1);

    //Control should never reach this point
    return IntersectData(false, 0);
}
Example #2
0
math::IntersectInfo physics::Collider::Intersect(const Collider& collider) const
{
	if (collider_types::TYPE_SPHERE == m_type && collider_types::TYPE_SPHERE == collider.GetType() )
	{
		const math::Sphere* self = dynamic_cast<const math::Sphere*>(this);
		if (self == nullptr)
		{
			CRITICAL_LOG_PHYSICS("Casting collider to BoundingSphere pointer failed.");
			exit(EXIT_FAILURE);
		}
		//return self->DoesIntersectSphere(static_cast<math::Sphere>(collider));
	}

	CRITICAL_LOG_PHYSICS("Only bounding spheres collision is currently handled by the physics engine. Other colliders are not yet supported.");
	return math::IntersectInfo(REAL_ONE /* some arbitrary (but positive) value */);
}