RectangleColliderComponent represents a 2D axis-aligned bounding box (AABB) collider. It provides collision detection and debug rendering for rectangular shapes in 2D space.
More...
#include <RectangleColliderComponent.h>
|
| RectangleColliderComponent (Actor *pOwner) |
| Constructor for RectangleColliderComponent.
|
|
void | DebugRender (IRenderer *pRenderer) override |
| Renders the rectangle as a line in the world for debugging purposes.
|
|
Rectangle | GetWorldRectangle () const |
| Gets the world-space rectangle based on the owner's position. Transforms the local-space rectangle to its global position.
|
|
bool | Collision (const Rectangle &otherRectangle) |
| Checks for collision with another rectangle in world space.
|
|
bool | Collision (const ColliderComponent *pComponent) override |
| Checks for collision with another collider component. Only supports collision with other RectangleColliderComponent instances.
|
|
| ColliderComponent (Actor *pOwner) |
| Constructor for ColliderComponent.
|
|
void | OnStart () override |
| Called when the component starts. Registers the component for debug rendering and adds it to the physics system.
|
|
void | OnEnd () override |
| Called when the component ends. Unregisters the component from debug rendering and removes it from the physics system.
|
|
| Component (Actor *pOwner, int pUpdateOrder=100) |
| Constructor for Component.
|
|
virtual | ~Component () |
|
virtual void | Update () |
| Called every frame to update the component. This can be used to perform actions that need to be updated periodically.
|
|
virtual void | OnUpdateWorldTrandform () |
| Called when the world transform of the actor is updated. This allows the component to react to changes in the actor's world transform.
|
|
void | SetActive (bool isActive) |
| Sets the active status of the component.
|
|
void | SetOwner (Actor *pOwner) |
| Sets the actor that owns this component.
|
|
int | GetUpdateOrder () const |
| Returns the update order of the component. Components with lower update orders are updated first.
|
|
Actor * | GetOwner () const |
| Returns the actor that owns this component.
|
|
|
Actor * | mOwner = nullptr |
| The actor that owns this component.
|
|
RectangleColliderComponent represents a 2D axis-aligned bounding box (AABB) collider. It provides collision detection and debug rendering for rectangular shapes in 2D space.
◆ RectangleColliderComponent()
RectangleColliderComponent::RectangleColliderComponent |
( |
Actor * | pOwner | ) |
|
◆ Collision() [1/2]
Checks for collision with another collider component. Only supports collision with other RectangleColliderComponent instances.
- Parameters
-
pComponent | Pointer to the other collider component. |
- Returns
- True if a collision is detected, false otherwise.
Implements ColliderComponent.
◆ Collision() [2/2]
bool RectangleColliderComponent::Collision |
( |
const Rectangle & | otherRectangle | ) |
|
Checks for collision with another rectangle in world space.
- Parameters
-
otherRectangle | The other rectangle to check against. |
- Returns
- True if a collision is detected, false otherwise.
◆ DebugRender()
void RectangleColliderComponent::DebugRender |
( |
IRenderer * | pRenderer | ) |
|
|
overridevirtual |
Renders the rectangle as a line in the world for debugging purposes.
- Parameters
-
pRenderer | The renderer used to draw the debug rectangle. |
Implements DebugRenderInterface.
◆ GetWorldRectangle()
Rectangle RectangleColliderComponent::GetWorldRectangle |
( |
| ) |
const |
Gets the world-space rectangle based on the owner's position. Transforms the local-space rectangle to its global position.
- Returns
- A Rectangle in world-space coordinates.
◆ mRectangle
Checks Local-space rectangle defining the collider shape.
The documentation for this class was generated from the following files: