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

Base class for collider components used in physics and collision detection. Inherits from Component for lifecycle management and DebugRenderInterface for debug visualization. More...

#include <ColliderComponent.h>

Inheritance diagram for ColliderComponent:
Component DebugRenderInterface BoxColliderComponent RectangleColliderComponent

Public Member Functions

 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.
 
virtual bool Collision (const ColliderComponent *pComponent)=0
 Pure virtual method to check collision with another collider component. Must be implemented by derived classes (e.g., BoxCollider, SphereCollider).
 
- 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 Member Functions inherited from DebugRenderInterface
virtual void DebugRender (IRenderer *renderer)=0
 

Public Attributes

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

Base class for collider components used in physics and collision detection. Inherits from Component for lifecycle management and DebugRenderInterface for debug visualization.

Constructor & Destructor Documentation

◆ ColliderComponent()

ColliderComponent::ColliderComponent ( Actor * pOwner)

Constructor for ColliderComponent.

Parameters
pOwnerThe actor that owns this collider component.

Member Function Documentation

◆ Collision()

virtual bool ColliderComponent::Collision ( const ColliderComponent * pComponent)
pure virtual

Pure virtual method to check collision with another collider component. Must be implemented by derived classes (e.g., BoxCollider, SphereCollider).

Parameters
pComponentPointer to another collider component to check collision against.
Returns
True if a collision is detected, false otherwise.

Implemented in BoxColliderComponent, and RectangleColliderComponent.

◆ OnEnd()

void ColliderComponent::OnEnd ( )
overridevirtual

Called when the component ends. Unregisters the component from debug rendering and removes it from the physics system.

Reimplemented from Component.

◆ OnStart()

void ColliderComponent::OnStart ( )
overridevirtual

Called when the component starts. Registers the component for debug rendering and adds it to the physics system.

Reimplemented from Component.

Member Data Documentation

◆ mColor

Color ColliderComponent::mColor { 255,0,0,255 }

Debug rendering color for the collider (default: red).


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