Provides an entity with a physical bounding box for collision detection. More...
#include <Collider.h>


Public Member Functions | |
| Collider (std::string tag, std::function< void(Collider &other)> onCollision, bool isTrigger=false, bool isStatic=false, bool considerVel=false, bool isUi=false) | |
| Constructs a fully configured Collider. | |
| Collider (std::string tag) | |
| Constructs a simple Collider with only a tag. | |
| void | init () override |
| Initializes the collider by linking it to the entity's transform. | |
| void | update () override |
| Updates the collider's position and checks for collisions against other colliders. | |
| void | onCollision (Collider &other) |
| Executes the collision callback function. | |
| const bool | isColliding (std::string collTag) |
| Checks if this collider is currently colliding with any collider of a specific tag. | |
Public Member Functions inherited from Component | |
| virtual void | reload () |
| Called to reset the component's state. | |
| virtual void | draw () |
| Called once per frame after update. Used for rendering. | |
Public Attributes | |
| std::string | tag |
| A tag to identify the type of collider (e.g., "player", "wall"). | |
Public Attributes inherited from Component | |
| Entity * | entity |
| Pointer to the entity that owns this component. | |
Provides an entity with a physical bounding box for collision detection.
Can function as a solid object, a trigger volume, or a static body. Executes a callback function upon collision with another collider.
| Collider::Collider | ( | std::string | tag, |
| std::function< void(Collider &other)> | onCollision, | ||
| bool | isTrigger = false, |
||
| bool | isStatic = false, |
||
| bool | considerVel = false, |
||
| bool | isUi = false |
||
| ) |
Constructs a fully configured Collider.
| tag | Identifier for this collider type. |
| onCollision | Callback function executed on collision. |
| isTrigger | If true, detects collisions but does not cause a physical response. |
| isStatic | If true, the collider is considered immovable. |
| considerVel | If true, includes velocity in collision checks for better tunneling prevention. |
| isUi | If true, indicates this is a UI element collider. |

| Collider::Collider | ( | std::string | tag | ) |
Constructs a simple Collider with only a tag.
| tag | Identifier for this collider type. |

|
overridevirtual |
Initializes the collider by linking it to the entity's transform.
Reimplemented from Component.

Checks if this collider is currently colliding with any collider of a specific tag.
| collTag | The tag to check for collision against. |


Executes the collision callback function.
| other | The Collider component of the other entity involved in the collision. |


|
overridevirtual |
Updates the collider's position and checks for collisions against other colliders.
Reimplemented from Component.
