A virtual derived class of GameObject that allows the GameObject to test for collison. More...
#include <Collidable.h>
Detailed Description
A virtual derived class of GameObject that allows the GameObject to test for collison.
A class that inherits from Collidable gains access to the Collision() function. This allows the user to execute code every time a collision is registered. This class also contains functions and entities for storing/getting information about the collision model.
Public Member Functions | |
virtual void | CollisionTerrain () |
Function that is called when collision with Terrain is triggered. More... | |
const CollisionVolume & | GetCollisionVolume () const |
Function to return a reference to the Collision Volume. More... | |
const CollisionVolumeBSphere & | GetDefualtBSphere () const |
Function to return a reference to the defualt Collision Volume. More... | |
![]() | |
void | SubmitEntry () |
Public Function to register a call for the GameObject's SceneEntry() function. More... | |
void | SubmitExit () |
Public Function to register a call for the GameObject's SceneEntry() function. More... | |
Protected Member Functions | |
virtual void | Collision (Collidable *ptrCol) |
Function that is called when collision with another Collidable GameObject is triggered. More... | |
void | SetColliderModel (Model *mod, VolumeType volume=VolumeType::BSPHERE) |
Function to set the Collider Model and Collision Volume of this Collidable GameObject. More... | |
void | UpdateCollisionData (Matrix &mat) |
Function to update the current Collidable placement. More... | |
template<typename C > | |
void | CollisionRegister (C *ptrCollision) |
Function to register this Collidable GameObject for collision. More... | |
template<typename C > | |
void | CollisionDeregister (C *ptrCollision) |
Function to deregister this Collidable GameObject from collision. More... | |
![]() | |
virtual void | SceneEntry ()=0 |
Function which is called upon a registered scene entry. More... | |
virtual void | SceneExit ()=0 |
Function which is called upon a registered scene exit. More... | |
Protected Attributes | |
Model * | pColModel |
CollisionVolume * | ColVolume |
Member Function Documentation
|
protectedvirtual |
Function that is called when collision with another Collidable GameObject is triggered.
This is a virtual function to be overriden by the user for each Collidable GameObject that is paired for Collision.
The Collision function is called every frame that the registered and paired Collidable GameObjects are colliding. To register the current Collidable GameObject for collision, see CollisionRegister() and CollisionDeregister(). To pair Collidable GameObjects for testing, see the Scene::SetCollisionPair() and Scene::SetCollisionSelf() functions.
- Parameters
-
ptrCol Pointer to the Collidable GameObject that is colliding with the current Collidable GameObject.
|
inlineprotected |
Function to deregister this Collidable GameObject from collision.
Deregistering the current Collidable GameObject removes this object from the list of Collidable's to be checked for collision each frame.
An example use of this function would go as follows:
|
inlineprotected |
Function to register this Collidable GameObject for collision.
Registering the current Collidable GameObject adds this object to the list of Collidable's to be checked for collision each frame.
An example use of this function would go as follows:
|
virtual |
Function that is called when collision with Terrain is triggered.
This is a virtual function to be overriden by the user for the Collidable GameObject that is paired for Collision with Terrain.
The CollisionTerrain function is called every frame that the registered Collidable is colliding with Terrain. To register the current Collidable GameObject for Terrain Collision, see the Scene::SetCollisionTerrain()
const CollisionVolume& Collidable::GetCollisionVolume | ( | ) | const |
Function to return a reference to the Collision Volume.
This function returns a reference to this Collidable GameObject's CollisionVolume.
- Returns
- const reference to the class's Collision volume
const CollisionVolumeBSphere& Collidable::GetDefualtBSphere | ( | ) | const |
Function to return a reference to the defualt Collision Volume.
This function returns a reference to this Collidable GameObject's defualt BSphere CollisionVolume.
- Returns
- const reference to the class's BSphere Collision volume
|
protected |
Function to set the Collider Model and Collision Volume of this Collidable GameObject.
This function assigns a model to the pointer pColModel and initialized the Collision Volume based on a VolumeType enum.
- Parameters
-
mod Pointer to model that this class will reference. volume VolumeType enum for the type of collision volume to use (defualts to BSHPERE)
|
protected |
Function to update the current Collidable placement.
This function updates the current placement of the collision data based on the world matrix passed in as parameter mat.
- Parameters
-
mat World Matrix reference.
Member Data Documentation
|
protected |
Collision Volume of the model stored as a CollisionVolume
|
protected |
Pointer to the model that will be tested for collision