Collider Class Referenceabstract

#include <Collider.h>

Inheritance diagram for Collider:
Component Ball Box LineField InverseBox

# Public Types

enum  CollisionResult
enum  ColliderClassIndexes
typedef const ColliderSpec ColliderROMSpec

# Public Member Functions

void constructor (Entity owner, const ColliderSpec *colliderSpec)
 Class' constructor.
override bool onEvent (ListenerObject eventFirer, uint16 eventCode)
override bool handleMessage (Telegram telegram)
override void handleCommand (int32 command, va_list args)
void enable ()
 Enable the collider for collision checks.
void disable ()
 Disable the collider for collision checks.
void setLayers (uint32 layers)
uint32 getLayers ()
void setLayersToIgnore (uint32 layersToIgnore)
uint32 getLayersToIgnore ()
void checkCollisions (bool checkCollisions)
void registerCollisions (bool registerCollisions)
CollisionResult collides (Collider collider)
void resolveCollision (const CollisionInformation *collisionInformation)
bool canMoveTowards (Vector3D displacement)
void discardCollisions ()
 Discard any registered collision.
fixed_t getCollidingFrictionCoefficient ()
void show ()
 Show the collider.
void hide ()
 Hide the collider.
virtual void resize (fixed_t sizeDelta)
virtual Vector3D getNormal ()
virtual void configureWireframe ()=0
 Configure the wireframe used to show the collider.
virtual void print (int32 x, int32 y)

# Protected Attributes

Vector3D position
 Displaced position.
VirtualList otherColliders
 List of colliding colliders.
uint32 layers
 Layers on which this collider live.
uint32 layersToIgnore
 Layers to ignore when checking for collisions.
Wireframe wireframe
 Wireframe to make the collider visible (mainly for debugging purposes)
bool enabled
 If false, it is ignored in all callision checks.
uint8 checkForCollisions
 If false, it doesn't check collision against other colliders.
bool registerCollisions
 If true, it registers other colliders when a collision arises.
uint8 classIndex
 Class index to avoid using __GET_CAST when checking for collisions.
bool invalidPosition
 Flag to force the computation of the collider's position.

# Additional Inherited Members

- Private Types inherited from Component
enum  ComponentCommands
enum  ComponentTypes
- Private Member Functions inherited from Component
void constructor (Entity owner, const ComponentSpec *componentSpec)
void destructor ()
 Class' destructor.
ComponentSpecgetSpec ()
Entity getOwner ()
 Retrieve the collider's owner.
uint32 getType ()
virtual void releaseResources ()
 Called to release the component.
virtual RightBox getRightBox ()
- Private Attributes inherited from Component
Entity owner
 Object to which this component attaches to.
const ComponentSpeccomponentSpec
 Pointer to the spec that defines how to initialize the component.
const Transformationtransformation
bool deleteMe
 Flag to mark the component as pending deletion.

# Detailed Description

Class Collider

Inherits from Component

Checks collisions against other colliders.

Definition at line 180 of file Collider.h.

# Member Typedef Documentation

# ColliderROMSpec

A ColliderSpec spec that is stored in ROM

Definition at line 169 of file Collider.h.

# Member Enumeration Documentation

# ColliderClassIndexes

Possible types of a colliders

Definition at line 62 of file Collider.h.

# CollisionResult

Collision events

Definition at line 51 of file Collider.h.

# Member Function Documentation

# canMoveTowards()

bool Collider::canMoveTowards ( Vector3D displacement)

Check if there is some collider blocking in the provided direction.

Parameters
displacementVector towards which to check if it is possible to move the owner
Returns
True if there is no collision when moving the collider and increasing its size

Definition at line 419 of file Collider.c.

# checkCollisions()

void Collider::checkCollisions ( bool checkCollisions)

Make this collider to test collision against other colliders.

Parameters
checkCollisionsIt true, this collider checks collision against others

Definition at line 268 of file Collider.c.

# collides()

CollisionResult Collider::collides ( Collider collider)

Check if there is there is a collision with the provided collider.

Parameters
colliderCollider to check collision against to

Definition at line 287 of file Collider.c.

# configureWireframe()

virtual void Collider::configureWireframe ( )
pure virtual

Configure the wireframe used to show the collider.

Implemented in Ball, Box, and LineField.

# constructor()

void Collider::constructor ( Entity owner,
const ColliderSpec * colliderSpec )

Class' constructor.

Definition at line 46 of file Collider.c.

# disable()

void Collider::disable ( )

Disable the collider for collision checks.

Definition at line 228 of file Collider.c.

# discardCollisions()

void Collider::discardCollisions ( )

Discard any registered collision.

Definition at line 453 of file Collider.c.

# enable()

void Collider::enable ( )

Enable the collider for collision checks.

Definition at line 216 of file Collider.c.

# getCollidingFrictionCoefficient()

fixed_t Collider::getCollidingFrictionCoefficient ( )

Get the total friction of colliding colliders.

Returns
The sum of friction coefficients of the colliders colliding's owners

Definition at line 481 of file Collider.c.

# getLayers()

uint32 Collider::getLayers ( )

Retrieve the layers in which this collider lives.

Returns
Layers in which the collider must live

Definition at line 247 of file Collider.c.

# getLayersToIgnore()

uint32 Collider::getLayersToIgnore ( )

Retrieve the layers in which live colliders to ignore when testing collisions.

Returns
Layers to ignore when checking collisions

Definition at line 261 of file Collider.c.

# getNormal()

Vector3D Collider::getNormal ( )
virtual

Retrieve the normal to the collider.

Returns
Normal to the collider

Reimplemented in LineField.

Definition at line 541 of file Collider.c.

# handleCommand()

void Collider::handleCommand ( int32 command,
va_list args )
virtual

Handle a command.

Parameters
commandCommand to handle
argsVariable arguments list depending on the command to handle

Reimplemented from Component.

Definition at line 168 of file Collider.c.

# handleMessage()

bool Collider::handleMessage ( Telegram telegram)
virtual

Process a Telegram.

Parameters
telegramTelegram to process
Returns
True if the Telegram was processed

Reimplemented from ListenerObject.

Definition at line 148 of file Collider.c.

# hide()

void Collider::hide ( )

Hide the collider.

Definition at line 525 of file Collider.c.

# onEvent()

bool Collider::onEvent ( ListenerObject eventFirer,
uint16 eventCode )
virtual

Process an event that the instance is listen for.

Parameters
eventFirerListenerObject that signals the event
eventCodeCode of the firing event
Returns
False if the listener has to be removed; true to keep it

Reimplemented from ListenerObject.

Definition at line 108 of file Collider.c.

# print()

void Collider::print ( int32 x,
int32 y )
virtual

Print collider's state.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Reimplemented in Ball, Box, and LineField.

Definition at line 549 of file Collider.c.

# registerCollisions()

void Collider::registerCollisions ( bool registerCollisions)

Keep track of colliding colliders to detect when collisions exit.

Parameters
registerCollisionsIf true, colliding colliders are registered

# resize()

void Collider::resize ( fixed_t sizeDelta)
virtual

Resize the colliders add the provided increment.

Parameters
sizeDeltaDelta to add to the collider's size

Reimplemented in Ball, and Box.

Definition at line 536 of file Collider.c.

# resolveCollision()

void Collider::resolveCollision ( const CollisionInformation * collisionInformation)

Resolve a collision by moving the owner to a position where the collision ceases.

Parameters
collisionInformationInformation struct about the collision to resolve

Definition at line 384 of file Collider.c.

# setLayers()

void Collider::setLayers ( uint32 layers)

Set the layers in which this collider lives.

Parameters
layersLayers in which the collider must live

Definition at line 240 of file Collider.c.

# setLayersToIgnore()

void Collider::setLayersToIgnore ( uint32 layersToIgnore)

Set the layers in which live colliders to ignore when testing collisions.

Parameters
layersToIgnoreLayers to ignore when checking collisions

Definition at line 254 of file Collider.c.

# show()

void Collider::show ( )

Show the collider.

Definition at line 510 of file Collider.c.

# Member Data Documentation

# checkForCollisions

uint8 Collider::checkForCollisions
protected

If false, it doesn't check collision against other colliders.

Definition at line 203 of file Collider.h.

# classIndex

uint8 Collider::classIndex
protected

Class index to avoid using __GET_CAST when checking for collisions.

Definition at line 209 of file Collider.h.

# enabled

bool Collider::enabled
protected

If false, it is ignored in all callision checks.

Definition at line 200 of file Collider.h.

# invalidPosition

bool Collider::invalidPosition
protected

Flag to force the computation of the collider's position.

Definition at line 212 of file Collider.h.

# layers

uint32 Collider::layers
protected

Layers on which this collider live.

Definition at line 191 of file Collider.h.

# layersToIgnore

uint32 Collider::layersToIgnore
protected

Layers to ignore when checking for collisions.

Definition at line 194 of file Collider.h.

# otherColliders

VirtualList Collider::otherColliders
protected

List of colliding colliders.

Definition at line 188 of file Collider.h.

# position

Vector3D Collider::position
protected

Displaced position.

Definition at line 185 of file Collider.h.

# registerCollisions

void Collider::registerCollisions
protected

If true, it registers other colliders when a collision arises.

Definition at line 206 of file Collider.h.

# wireframe

Wireframe Collider::wireframe
protected

Wireframe to make the collider visible (mainly for debugging purposes)

Definition at line 197 of file Collider.h.


The documentation for this class was generated from the following files:
  • VUEngine-Core/source/Component/Collider/Collider.h
  • VUEngine-Core/source/Component/Collider/Collider.c