ArnieBoids  1.0.0
JOINT AI PROJECT
CollisionSystem Class Reference

Collision System class. Provides collision checks for SFML ConvexShapes. Provides SAT collision for narrow-phase checks and bounding box collision for broad-phase checks. More...

#include <CollisionSystem.hpp>

Collaboration diagram for CollisionSystem:

Public Member Functions

 CollisionSystem (std::list< Ship * > &shipList, std::list< Bullet * > &bulletList, std::list< Pickup * > &pickupList)
 
 ~CollisionSystem ()
 
void Check () const
 Checks for collision between all game entities. Checks for ship-ship collision (broad and narrow phase), checks for ship-bullet collision (broad phase only, with PLAYER/ENEMY factions), checks for ship-powerup collision (broad and narrow phase, only player and predators can collect powerups). More...
 

Private Member Functions

bool checkPair (sf::ConvexShape *first, sf::ConvexShape *second) const
 Check two ships for collision. More...
 
void getAxies (const sf::ConvexShape *const shape, std::list< sf::Vector2f > &axies) const
 Get the axies of a shape and insert them into the list. More...
 
sf::Vector2f projectOntoAxis (const sf::ConvexShape *const shape, sf::Vector2f &axis) const
 Project a shape onto an axis and return the line projection. More...
 

Private Attributes

std::list< Ship * > & ships_
 A reference to Game::ships_. More...
 
std::list< Bullet * > & bullets_
 A reference to Game::bullets_. More...
 
std::list< Pickup * > & pickups_
 A reference to Game::pickups_. More...
 

Detailed Description

Collision System class. Provides collision checks for SFML ConvexShapes. Provides SAT collision for narrow-phase checks and bounding box collision for broad-phase checks.

Remarks
Contains references to game lists.
Due to a bug with bullets (but not missiles for some reason), SAT has been disabled for all bullets (solely bounding box collision is used).

Constructor & Destructor Documentation

CollisionSystem::CollisionSystem ( std::list< Ship * > &  shipList,
std::list< Bullet * > &  bulletList,
std::list< Pickup * > &  pickupList 
)

Creates a collision system with references to lists of entities from Game

Parameters
shipListA reference to a list of ship pointers.
bulletListA reference to a list of bullet pointers.
pickupListA reference to a list of pickup pointers.
CollisionSystem::~CollisionSystem ( )

Member Function Documentation

void CollisionSystem::Check ( ) const

Checks for collision between all game entities. Checks for ship-ship collision (broad and narrow phase), checks for ship-bullet collision (broad phase only, with PLAYER/ENEMY factions), checks for ship-powerup collision (broad and narrow phase, only player and predators can collect powerups).

Here is the call graph for this function:

Here is the caller graph for this function:

bool CollisionSystem::checkPair ( sf::ConvexShape *  first,
sf::ConvexShape *  second 
) const
private

Check two ships for collision.

Here is the call graph for this function:

Here is the caller graph for this function:

void CollisionSystem::getAxies ( const sf::ConvexShape *const  shape,
std::list< sf::Vector2f > &  axies 
) const
private

Get the axies of a shape and insert them into the list.

Here is the caller graph for this function:

sf::Vector2f CollisionSystem::projectOntoAxis ( const sf::ConvexShape *const  shape,
sf::Vector2f &  axis 
) const
private

Project a shape onto an axis and return the line projection.

Here is the caller graph for this function:

Member Data Documentation

std::list<Bullet*>& CollisionSystem::bullets_
private

A reference to Game::bullets_.

std::list<Pickup*>& CollisionSystem::pickups_
private

A reference to Game::pickups_.

std::list<Ship*>& CollisionSystem::ships_
private

A reference to Game::ships_.


The documentation for this class was generated from the following files: