Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::Physics Class Reference

The Physics class handles the physics simulation, including collision detection and resolution. More...

#include <Physics.h>

Public Member Functions

 Physics ()
 Constructs a new Physics object.
 
 ~Physics ()=default
 Destroys the Physics object.
 
bool LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false, Actor *self=nullptr)
 Performs a line trace (raycast) in the physics world.
 
void AddCollider (ColliderComponent *pCollider)
 Adds a collider to the simulation.
 
void RemoveCollider (ColliderComponent *pCollider)
 Removes a collider from the simulation.
 
void AddRigidbody (RigidBody *pRigidbody)
 Adds a rigid body to the simulation.
 
void RemoveRigidBody (RigidBody *pRigidbody)
 Removes a rigid body from the simulation.
 
void SubscribeTo (ColliderComponent *pCollider, ICollisionListener *pListener)
 Subscribes a listener to collision events for a specific collider.
 
void Update ()
 Updates the physics simulation.
 

Detailed Description

The Physics class handles the physics simulation, including collision detection and resolution.

Member Function Documentation

◆ AddCollider()

void Physics::AddCollider ( ColliderComponent * pCollider)

Adds a collider to the simulation.

Parameters
pColliderThe collider to add.

◆ AddRigidbody()

void Physics::AddRigidbody ( RigidBody * pRigidbody)

Adds a rigid body to the simulation.

Parameters
pRigidbodyThe rigid body to add.

◆ LineTrace()

bool Physics::LineTrace ( Vector3 start,
Vector3 direction,
float maxDistance,
raycastHit & hit,
bool debugPersistant = false,
Actor * self = nullptr )

Performs a line trace (raycast) in the physics world.

Parameters
startThe starting point of the trace.
directionThe direction of the trace.
maxDistanceThe maximum distance to trace.
hitThe result of the trace if a hit occurs.
debugPersistantWhether to persist debug visualization.
selfThe actor to ignore during the trace.
Returns
True if the trace hit something, false otherwise.

◆ RemoveCollider()

void Physics::RemoveCollider ( ColliderComponent * pCollider)

Removes a collider from the simulation.

Parameters
pColliderThe collider to remove.

◆ RemoveRigidBody()

void Physics::RemoveRigidBody ( RigidBody * pRigidbody)

Removes a rigid body from the simulation.

Parameters
pRigidbodyThe rigid body to remove.

◆ SubscribeTo()

void Physics::SubscribeTo ( ColliderComponent * pCollider,
ICollisionListener * pListener )

Subscribes a listener to collision events for a specific collider.

Parameters
pColliderThe collider to subscribe to.
pListenerThe listener to notify of collision events.

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