Collider Class Referenceabstract
#include <Collider.h>
# 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. | |
| ComponentSpec * | getSpec () |
| 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 ComponentSpec * | componentSpec |
| Pointer to the spec that defines how to initialize the component. | |
| const Transformation * | transformation |
| 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
| typedef const ColliderSpec ColliderROMSpec |
A ColliderSpec spec that is stored in ROM
Definition at line 169 of file Collider.h.
# Member Enumeration Documentation
# ColliderClassIndexes
| enum ColliderClassIndexes |
Possible types of a colliders
Definition at line 62 of file Collider.h.
# CollisionResult
| enum CollisionResult |
Collision events
Definition at line 51 of file Collider.h.
# Member Function Documentation
# canMoveTowards()
Check if there is some collider blocking in the provided direction.
- Parameters
-
displacement Vector 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
-
checkCollisions It 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
-
collider Collider to check collision against to
Definition at line 287 of file Collider.c.
# configureWireframe()
|
pure virtual |
# 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()
|
virtual |
Retrieve the normal to the collider.
- Returns
- Normal to the collider
Reimplemented in LineField.
Definition at line 541 of file Collider.c.
# handleCommand()
|
virtual |
Handle a command.
- Parameters
-
command Command to handle args Variable arguments list depending on the command to handle
Reimplemented from Component.
Definition at line 168 of file Collider.c.
# handleMessage()
Process a Telegram.
- Parameters
-
telegram Telegram 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()
|
virtual |
Process an event that the instance is listen for.
- Parameters
-
eventFirer ListenerObject that signals the event eventCode Code 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()
Print collider's state.
- Parameters
-
x Screen x coordinate where to print y Screen 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
-
registerCollisions If true, colliding colliders are registered
# resize()
|
virtual |
Resize the colliders add the provided increment.
- Parameters
-
sizeDelta Delta 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
-
collisionInformation Information 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
-
layers Layers 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
-
layersToIgnore Layers 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
|
protected |
If false, it doesn't check collision against other colliders.
Definition at line 203 of file Collider.h.
# classIndex
|
protected |
Class index to avoid using __GET_CAST when checking for collisions.
Definition at line 209 of file Collider.h.
# enabled
|
protected |
If false, it is ignored in all callision checks.
Definition at line 200 of file Collider.h.
# invalidPosition
|
protected |
Flag to force the computation of the collider's position.
Definition at line 212 of file Collider.h.
# layers
|
protected |
Layers on which this collider live.
Definition at line 191 of file Collider.h.
# layersToIgnore
|
protected |
Layers to ignore when checking for collisions.
Definition at line 194 of file Collider.h.
# otherColliders
|
protected |
List of colliding colliders.
Definition at line 188 of file Collider.h.
# position
|
protected |
Displaced position.
Definition at line 185 of file Collider.h.
# registerCollisions
|
protected |
If true, it registers other colliders when a collision arises.
Definition at line 206 of file Collider.h.
# 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
Private Types inherited from