Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

CollisionHandler Class Reference

#include <CollisionHandler.h>

List of all members.

Public Types

typedef vector< Collider * >
::iterator 
ColliderIter

Public Member Functions

void clear ()
void addCollider (Collider *collider)
void removeCollider (Collider *collider)
void detectCollisions ()
ColliderIter colliderIteratorBegin ()
ColliderIter colliderIteratorEnd ()
bool rayCast (const Ray &ray, RayCastHit &hit, Collider *ignore=NULL) const

Protected Member Functions

bool detectSphereSphereCollision (const SphereCollider *const col1, const SphereCollider *const col2, CollisionHit &hit)
bool detectSphereBoxCollision (const SphereCollider *const col1, const BoxCollider *const col2, CollisionHit &hit)
bool detectSpherePlaneCollision (const SphereCollider *const col1, const PlaneCollider *const col2, CollisionHit &hit)
bool detectBoxBoxCollision (const BoxCollider *const col1, const BoxCollider *const col2, CollisionHit &hit)
bool detectBoxPlaneCollision (const BoxCollider *const col1, const PlaneCollider *const col2, CollisionHit &hit)
bool detectPlanePlaneCollision (const PlaneCollider *const col1, const PlaneCollider *const col2, CollisionHit &hit)

Protected Attributes

vector< Collider * > colliders

Detailed Description

Core class of the engine, keeps track of the colliders present in the scene and resolves the collisions.


Member Function Documentation

void CollisionHandler::clear (  ) 

Remove all the collider from the handler, colliders still exist.

bool CollisionHandler::detectBoxBoxCollision ( const BoxCollider *const   col1,
const BoxCollider *const   col2,
CollisionHit hit 
) [protected]

Detect a collision between two oriented boxes, the penetration is filled int the reference to the CollisionHit

bool CollisionHandler::detectBoxPlaneCollision ( const BoxCollider *const   col1,
const PlaneCollider *const   col2,
CollisionHit hit 
) [protected]

Detect a collision between an oriented box and a plane, the penetration is filled int the reference to the CollisionHit

void CollisionHandler::detectCollisions (  ) 

Resolve the collisions, n2 pass to detect the collision and to move the objects so that they don't collide anymore. The object are moved according to the penetration odf the colliders.

bool CollisionHandler::detectPlanePlaneCollision ( const PlaneCollider *const   col1,
const PlaneCollider *const   col2,
CollisionHit hit 
) [protected]

Detect a collision between two planes, not implemented/used

bool CollisionHandler::detectSphereBoxCollision ( const SphereCollider *const   col1,
const BoxCollider *const   col2,
CollisionHit hit 
) [protected]

Detect a collision between a sphere and an oriented box, the penetration is filled int the reference to the CollisionHit

bool CollisionHandler::detectSpherePlaneCollision ( const SphereCollider *const   col1,
const PlaneCollider *const   col2,
CollisionHit hit 
) [protected]

Detect a collision between a sphere and a plane, the penetration is filled int the reference to the CollisionHit

bool CollisionHandler::detectSphereSphereCollision ( const SphereCollider *const   col1,
const SphereCollider *const   col2,
CollisionHit hit 
) [protected]

Detect a collision between two spheres, the penetration is filled int the reference to the CollisionHit

bool CollisionHandler::rayCast ( const Ray ray,
RayCastHit hit,
Collider ignore = NULL 
) const

Cast a ray against all the colliders in the scene except ignore. Returns true if a collider is intersection with the ray, false otherwise. The reference to a RayCastHit is filled with info about the closest collider from the origine on the ray.


Member Data Documentation

vector<Collider*> CollisionHandler::colliders [protected]

All the colliders in the scene


The documentation for this class was generated from the following files:
 All Classes Functions Variables