#include <PhPolygonCollision.h>
Public Member Functions | |
PhPolygonCollisionHandler () | |
Construct. | |
~PhPolygonCollisionHandler () | |
Destruct. | |
PhCollisionData | isColliding (PhPolygon A, PhPolygon B) |
Is colliding (polygon to polygon). | |
void | testObjectCollidingStatic (PhCollisionObject *A) |
Test static collisions. | |
bool | isColliding (PhCollisionObject *A, PhCollisionObject *B) |
Is colliding (object to object). | |
void | testCollisions () |
Test collisions. | |
void | addObject (PhCollisionObject *a) |
Add object. | |
void | removeObject (PhCollisionObject *a) |
Remove object. | |
void | addStaticGeometry (PhPolygon p, int t=1) |
Add static geometry. | |
void | addStaticGeometry (PhStaticGeometry g) |
Add static geometry. | |
void | removeStaticGeometry (PhStaticGeometry g) |
Remove static geometry. | |
vector< PhStaticGeometry > | getStaticGeometry () |
Get static geometry. | |
void | clearStaticGeometry () |
Clear static geometry. | |
Protected Attributes | |
vector< PhCollisionObject * > | colobjs |
List of collision objects. | |
vector< PhStaticGeometry > | level |
List of static geometry. |
Provides a simple and effective way to test for collisions using polygons and collision objects.
PhCollisionData phoenix::PhPolygonCollisionHandler::isColliding | ( | PhPolygon | A, | |
PhPolygon | B | |||
) |
Is colliding (polygon to polygon).
polygon to polygon, can be called if you don't want to use collision objects or just want some simple tests.
A | The polygon to test. | |
B | The polygon to test against. |
void phoenix::PhPolygonCollisionHandler::testObjectCollidingStatic | ( | PhCollisionObject * | A | ) |
Test static collisions.
Test a collision object against the static geometry and performs callback. Can be called directly, but this function is called by testObjectCollisions().
A | The object to test. |
bool phoenix::PhPolygonCollisionHandler::isColliding | ( | PhCollisionObject * | A, | |
PhCollisionObject * | B | |||
) |
Is colliding (object to object).
Does collision testing between two objects, calls both callbacks for the objects. can be called directly, but this function is called by testObjectCollisions().
void phoenix::PhPolygonCollisionHandler::testCollisions | ( | ) |
Test collisions.
This is the main function of the collision manager. This goes through all the collision objects and tests them against each other and the list of static geometry. It does callbacks and if used in conjuction with the scenemanager can do it nearly transparently.
void phoenix::PhPolygonCollisionHandler::addObject | ( | PhCollisionObject * | a | ) |
Add object.
a | The object to be added to the list. |
void phoenix::PhPolygonCollisionHandler::removeObject | ( | PhCollisionObject * | a | ) |
Remove object.
a | The object to be removed from the list. |
void phoenix::PhPolygonCollisionHandler::addStaticGeometry | ( | PhPolygon | p, | |
int | t = 1 | |||
) |
Add static geometry.
Adds static geometry given a polygon and a type. Usually a type of 1 is treated as a solid block and it is the defualt for this function.
p | The polygon to be added as static geometry. | |
t | The type. |
void phoenix::PhPolygonCollisionHandler::addStaticGeometry | ( | PhStaticGeometry | g | ) |
Add static geometry.
g | The static geometry to be added to the list. |
void phoenix::PhPolygonCollisionHandler::removeStaticGeometry | ( | PhStaticGeometry | g | ) |
Remove static geometry.
g | The static geometry to be removed. |
vector<PhStaticGeometry> phoenix::PhPolygonCollisionHandler::getStaticGeometry | ( | ) |
Get static geometry.
This returns a list of all the static geometry. This can be used to draw all the static geometry if you really wanted to.
void phoenix::PhPolygonCollisionHandler::clearStaticGeometry | ( | ) |
Clear static geometry.
Removes all the static geometry from the list.
vector<PhCollisionObject*> phoenix::PhPolygonCollisionHandler::colobjs [protected] |
List of collision objects.
A list of all collision objects for testing.
vector<PhStaticGeometry> phoenix::PhPolygonCollisionHandler::level [protected] |
List of static geometry.
A list of static geometry used for testing.