Collider

Inherited: Component

Description

The Collider class provides a foundation for creating collision shapes within a physics environment. It can be attached to a RigidBody for dynamic interactions or placed directly in the physics world for static collisions. Derived classes should implement specific collision shape creation in the shape() method. The class also includes methods for managing collision contacts, emitting signals, and visualizing the collider in the editor.

Public Methods

RigidBody *

attachedRigidBody () const

void

cleanContacts ()

void

createCollider ()

void

dirtyContacts ()

void

setAttachedRigidBody (RigidBody * body)

void

setContact (Collider * collider)

btCollisionShape *

shape ()

void

update ()

Static Methods

None

Methods Description

:ref:`RigidBody<api_RigidBody>`* Collider::attachedRigidBody () const

Returns a pointer to the attached RigidBody if one is associated with.

See also setAttachedRigidBody().


void Collider::cleanContacts ()

Cleans up stale collision contacts and emits signals for collisions that have ended.


void Collider::createCollider ()

Creates the Bullet Physics collision object associated with the collider and adds it to the physics world.


void Collider::dirtyContacts ()

Marks all current collision contacts as dirty, indicating that they should be checked for updates.


void Collider::setAttachedRigidBody (RigidBody * body)

Attaches the collider to a specific rigid body. If a RigidBody is attached, the collider will be managed by the rigid body.

See also attachedRigidBody().


void Collider::setContact (Collider * collider)

Sets a new collision contact with another collider. Emits appropriate signals based on whether the contact is new, sustained, or ended.


:ref:`btCollisionShape<api_btCollisionShape>`* Collider::shape ()

Returns a pointer to the Bullet Physics collision shape associated with the collider. Derived classes should implement this method to define specific collision shapes.


void Collider::update ()

Placeholder method for updating the collider. Override this method in derived classes for specific update behavior.