Claire's Game Engine
Full C++ Engine using OpenGL
Loading...
Searching...
No Matches
BoxColliderComponent Class Reference

BoxColliderComponent represents an axis-aligned bounding box (AABB) collider. It handles collision detection using box geometry and provides debug rendering. More...

#include <BoxColliderComponent.h>

Inheritance diagram for BoxColliderComponent:
ColliderComponent Component DebugRenderInterface

Public Member Functions

 BoxColliderComponent (Actor *pOwner, Box pBox={})
 Constructor for BoxColliderComponent.
 
void DebugRender (IRenderer *pRenderer) override
 Renders a wireframe box in the world for debugging purposes.
 
bool Collision (const ColliderComponent *pComponent) override
 Checks for collision between this box collider and another collider. Only supports collision with other BoxColliderComponent instances.
 
Box GetWorldBox () const
 Gets the world-space representation of this box collider. Takes into account the owning actor's transform (position and scale).
 
- Public Member Functions inherited from ColliderComponent
 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.
 
- Public Member Functions inherited from Component
 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.
 
ActorGetOwner () const
 Returns the actor that owns this component.
 

Public Attributes

Box mBox
 Local-space axis-aligned box defining the collider shape.
 
- Public Attributes inherited from ColliderComponent
Color mColor { 255,0,0,255 }
 Debug rendering color for the collider (default: red).
 

Additional Inherited Members

- Protected Attributes inherited from Component
ActormOwner = nullptr
 The actor that owns this component.
 

Detailed Description

BoxColliderComponent represents an axis-aligned bounding box (AABB) collider. It handles collision detection using box geometry and provides debug rendering.

Constructor & Destructor Documentation

◆ BoxColliderComponent()

BoxColliderComponent::BoxColliderComponent ( Actor * pOwner,
Box pBox = {} )

Constructor for BoxColliderComponent.

Parameters
pOwnerThe actor that owns this collider component.
pBoxThe local-space box geometry for the collider (default: empty box).

Member Function Documentation

◆ Collision()

bool BoxColliderComponent::Collision ( const ColliderComponent * pComponent)
overridevirtual

Checks for collision between this box collider and another collider. Only supports collision with other BoxColliderComponent instances.

Parameters
pComponentPointer to the other collider component.
Returns
True if a collision is detected, false otherwise.

Implements ColliderComponent.

◆ DebugRender()

void BoxColliderComponent::DebugRender ( IRenderer * pRenderer)
overridevirtual

Renders a wireframe box in the world for debugging purposes.

Parameters
pRendererThe renderer used to draw the debug geometry.

Implements DebugRenderInterface.

◆ GetWorldBox()

Box BoxColliderComponent::GetWorldBox ( ) const

Gets the world-space representation of this box collider. Takes into account the owning actor's transform (position and scale).

Returns
The world-space bounding box.

Member Data Documentation

◆ mBox

Box BoxColliderComponent::mBox

Local-space axis-aligned box defining the collider shape.


The documentation for this class was generated from the following files: