|
Hymn to Beauty
C++ 3D Engine
|
Updates the physics of the world. More...
#include <PhysicsManager.hpp>
Public Member Functions | |
| void | Update (float deltaTime) |
| Moves entities and updates the physics component. More... | |
| void | UpdateEntityTransforms () |
| void | OnTriggerEnter (Utility::LockBox< Physics::Trigger > trigger, Component::RigidBody *object, std::function< void()> callback) |
| Set up listener for when |object| has entered |trigger|. More... | |
| void | ForgetTriggerEnter (Utility::LockBox< Physics::Trigger > trigger, Component::RigidBody *object) |
| Stop listening for when |object| has entered |trigger|. More... | |
| void | OnTriggerRetain (Utility::LockBox< Physics::Trigger > trigger, Component::RigidBody *object, std::function< void()> callback) |
| Set up listener for when |object| is intersecting |trigger|. More... | |
| void | ForgetTriggerRetain (Utility::LockBox< Physics::Trigger > trigger, Component::RigidBody *object) |
| Stop listening for when |object| is intersecting |trigger|. More... | |
| void | OnTriggerLeave (Utility::LockBox< Physics::Trigger > trigger, Component::RigidBody *object, std::function< void()> callback) |
| Set up listener for when |object| has left |trigger|. More... | |
| void | ForgetTriggerLeave (Utility::LockBox< Physics::Trigger > trigger, Component::RigidBody *object) |
| Stop listening for when |object| has left |trigger|. More... | |
| Component::RigidBody * | CreateRigidBody (Entity *owner) |
| Create rigid body component. More... | |
| Component::Shape * | CreateShape (Entity *owner) |
| Create a component that represents a physical shape. More... | |
| Utility::LockBox< Physics::Trigger > | CreateTrigger (std::shared_ptr< Physics::Shape > shape) |
| void | ReleaseTriggerVolume (Utility::LockBox< Physics::Trigger > &&trigger) |
| void | SetPosition (Utility::LockBox< Physics::Trigger > trigger, const glm::vec3 &position) |
| Set the position of a trigger volume. More... | |
| void | SetShape (Component::Shape *comp, std::shared_ptr<::Physics::Shape > shape) |
| Set the shape of a given Component::Shape component. More... | |
| float | GetMass (Component::RigidBody *comp) |
| Get the mass of a rigid body component. More... | |
| void | SetShape (Utility::LockBox< Physics::Trigger > trigger, std::shared_ptr< Physics::Shape > shape) |
| Set the volume shape of a trigger. More... | |
| void | SetMass (Component::RigidBody *comp, float mass) |
| Set the mass of a Component::RigidBody component. More... | |
| void | SetFriction (Component::RigidBody *comp, float friction) |
| Set the friction coefficient of a Component::RigidBody component. More... | |
| void | SetRollingFriction (Component::RigidBody *comp, float friction) |
| void | SetSpinningFriction (Component::RigidBody *comp, float friction) |
| void | SetRestitution (Component::RigidBody *comp, float cor) |
| Set the restitution (bounciness) of a Component::RigidBody component. More... | |
| void | SetLinearDamping (Component::RigidBody *comp, float damping) |
| Set the linear damping factor of a Component::RigidBody component. More... | |
| void | SetAngularDamping (Component::RigidBody *comp, float damping) |
| Set the angular damping factor of a Component::RigidBody component. More... | |
| void | MakeKinematic (Component::RigidBody *comp) |
| void | MakeDynamic (Component::RigidBody *comp) |
| Turn a rigid body into a dynamic object. More... | |
| void | SetGhost (Component::RigidBody *comp, bool ghost) |
| Enables/disables ghost functionality on a rigid body. More... | |
| void | ForceTransformSync (Component::RigidBody *comp) |
| void | HaltMovement (Component::RigidBody *comp) |
| Halts movement of a kinematic rigid body. More... | |
| const std::vector< Component::Shape * > & | GetShapeComponents () const |
| Get all shape components. More... | |
| void | ClearKilledComponents () |
| Remove all killed components. More... | |
| btDiscreteDynamicsWorld * | GetDynamicsWorld () |
| Get the Bullet dynamics world. More... | |
Friends | |
| class | Hub |
Updates the physics of the world.
| void PhysicsManager::ClearKilledComponents | ( | ) |
Remove all killed components.
| Component::RigidBody * PhysicsManager::CreateRigidBody | ( | Entity * | owner | ) |
Create rigid body component.
| owner | The Entity that will own the component. |
| Component::Shape * PhysicsManager::CreateShape | ( | Entity * | owner | ) |
Create a component that represents a physical shape.
| owner | The Entity that will own the component. |
| Utility::LockBox< Physics::Trigger > PhysicsManager::CreateTrigger | ( | std::shared_ptr< Physics::Shape > | shape | ) |
Create a trigger volume that can be used to check intersection events against physics bodies.
| shape | Shape of the trigger volume. |
| void PhysicsManager::ForceTransformSync | ( | Component::RigidBody * | comp | ) |
Forces a dynamic rigid body to synchronize its transform with that of its owning entity during the next simulation iteration.
| comp | Rigid body to synchronize. |
| void PhysicsManager::ForgetTriggerEnter | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| Component::RigidBody * | object | ||
| ) |
Stop listening for when |object| has entered |trigger|.
| trigger | What trigger to stop listening on. |
| object | Body that is to be forgotten. |
| void PhysicsManager::ForgetTriggerLeave | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| Component::RigidBody * | object | ||
| ) |
Stop listening for when |object| has left |trigger|.
| trigger | What trigger to stop listening on. |
| object | Body that is to be forgotten. |
| void PhysicsManager::ForgetTriggerRetain | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| Component::RigidBody * | object | ||
| ) |
Stop listening for when |object| is intersecting |trigger|.
| trigger | What trigger to stop listening on. |
| object | Body that is to be forgotten. |
| btDiscreteDynamicsWorld * PhysicsManager::GetDynamicsWorld | ( | ) |
Get the Bullet dynamics world.
| float PhysicsManager::GetMass | ( | Component::RigidBody * | comp | ) |
Get the mass of a rigid body component.
| comp | Rigid body component to get mass of. |
| const std::vector< Component::Shape * > & PhysicsManager::GetShapeComponents | ( | ) | const |
Get all shape components.
| void PhysicsManager::HaltMovement | ( | Component::RigidBody * | comp | ) |
Halts movement of a kinematic rigid body.
| comp | Rigid body to halt. |
| void PhysicsManager::MakeDynamic | ( | Component::RigidBody * | comp | ) |
Turn a rigid body into a dynamic object.
| comp | Rigid body to make dynamic. |
| void PhysicsManager::MakeKinematic | ( | Component::RigidBody * | comp | ) |
Turn a rigid body into a kinematic object, putting movement in the control of the programmer.
| comp | Rigid body to make kinematic. |
| void PhysicsManager::OnTriggerEnter | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| Component::RigidBody * | object, | ||
| std::function< void()> | callback | ||
| ) |
Set up listener for when |object| has entered |trigger|.
| trigger | What trigger to check against. |
| object | Body that is to enter the trigger volume. |
| callback | Function to call when resolving event. |
| void PhysicsManager::OnTriggerLeave | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| Component::RigidBody * | object, | ||
| std::function< void()> | callback | ||
| ) |
Set up listener for when |object| has left |trigger|.
| trigger | What trigger to check against. |
| object | Body that is to cause trigger to fire. |
| callback | Function to call when resolving event. |
| void PhysicsManager::OnTriggerRetain | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| Component::RigidBody * | object, | ||
| std::function< void()> | callback | ||
| ) |
Set up listener for when |object| is intersecting |trigger|.
| trigger | What trigger to check against. |
| object | Body that is to cause trigger to fire. |
| callback | Function to call when resolving event. |
| void PhysicsManager::ReleaseTriggerVolume | ( | Utility::LockBox< Physics::Trigger > && | trigger | ) |
Inform the physics manager that a given trigger volume will no longer be used so that it can be freed from memory.
| trigger | Trigger volume to release. |
| void PhysicsManager::SetAngularDamping | ( | Component::RigidBody * | comp, |
| float | damping | ||
| ) |
Set the angular damping factor of a Component::RigidBody component.
| comp | Rigid body to alter. |
| damping | Angular damping. |
| void PhysicsManager::SetFriction | ( | Component::RigidBody * | comp, |
| float | friction | ||
| ) |
Set the friction coefficient of a Component::RigidBody component.
| comp | Rigid body to alter. |
| friction | Friction coefficient. |
| void PhysicsManager::SetGhost | ( | Component::RigidBody * | comp, |
| bool | ghost | ||
| ) |
Enables/disables ghost functionality on a rigid body.
| comp | Rigid body to alter state of. |
| ghost | True: makes the rigid object a ghost, disregarding all collisions. False: disables ghost state, reverting to kinematic or dynamic as before. |
| void PhysicsManager::SetLinearDamping | ( | Component::RigidBody * | comp, |
| float | damping | ||
| ) |
Set the linear damping factor of a Component::RigidBody component.
| comp | Rigid body to alter. |
| damping | Linear damping. |
| void PhysicsManager::SetMass | ( | Component::RigidBody * | comp, |
| float | mass | ||
| ) |
Set the mass of a Component::RigidBody component.
| comp | The component on which to set mass. |
| mass | Mass in kilograms. |
| void PhysicsManager::SetPosition | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| const glm::vec3 & | position | ||
| ) |
Set the position of a trigger volume.
| trigger | Volume to reposition. |
| position | New position in world space. |
| void PhysicsManager::SetRestitution | ( | Component::RigidBody * | comp, |
| float | cor | ||
| ) |
Set the restitution (bounciness) of a Component::RigidBody component.
| comp | Rigid body to alter. |
| cor | Coefficient of restitution. |
| void PhysicsManager::SetRollingFriction | ( | Component::RigidBody * | comp, |
| float | friction | ||
| ) |
Set the rolling friction coefficient of a Component::RigidBody component.
| comp | Rigid body to alter. |
| friction | Friction coefficient. |
| void PhysicsManager::SetShape | ( | Component::Shape * | comp, |
| std::shared_ptr<::Physics::Shape > | shape | ||
| ) |
Set the shape of a given Component::Shape component.
| comp | The component on which to set the shape. |
| shape | A Physics::Shape object that holds the shape definition. |
| void PhysicsManager::SetShape | ( | Utility::LockBox< Physics::Trigger > | trigger, |
| std::shared_ptr< Physics::Shape > | shape | ||
| ) |
Set the volume shape of a trigger.
| trigger | Trigger to alter shape of. |
| shape | Shape definition. |
| void PhysicsManager::SetSpinningFriction | ( | Component::RigidBody * | comp, |
| float | friction | ||
| ) |
Set the spinning friction coefficient of a Component::RigidBody component.
| comp | Rigid body to alter. |
| friction | Friction coefficient. |
| void PhysicsManager::Update | ( | float | deltaTime | ) |
Moves entities and updates the physics component.
| deltaTime | Time since last frame (in seconds). |
| void PhysicsManager::UpdateEntityTransforms | ( | ) |
Update transforms of entities according to positions of physics components.
|
friend |