|
Monad Engine da02fba2
> Undercity Codex_
|
Owns the Bullet btDiscreteDynamicsWorld and all auxiliary collision structures (broadphase, dispatcher, solver).
More...
#include <PhysicsManager.h>
Public Member Functions | |
| PhysicsManager () | |
| ~PhysicsManager () | |
| void | Init () |
| Allocate broadphase, dispatcher, solver, and dynamics world. Call once. | |
| void | Update (float deltaTime) |
Step the simulation by deltaTime seconds. | |
| void | AddRigidBody (RigidBody *body) |
| Register a rigid body so it participates in simulation and collision. | |
| void | RemoveRigidBody (RigidBody *body) |
| Unregister a rigid body (e.g. when its owning component is destroyed). | |
| bool | Raycast (const vec3 &from, const vec3 &to, RayHit &out) |
| btDiscreteDynamicsWorld * | GetWorld () |
| Raw pointer to the underlying Bullet world (for advanced/internal use). | |
Owns the Bullet btDiscreteDynamicsWorld and all auxiliary collision structures (broadphase, dispatcher, solver).
One instance lives on the Engine singleton. PhysicsComponent pushes its RigidBody here via AddRigidBody; Engine::Run calls Update once per frame to step the simulation.
Definition at line 33 of file PhysicsManager.h.
| mnd::PhysicsManager::PhysicsManager | ( | ) |
Definition at line 13 of file PhysicsManager.cpp.
| mnd::PhysicsManager::~PhysicsManager | ( | ) |
Definition at line 15 of file PhysicsManager.cpp.
| void mnd::PhysicsManager::AddRigidBody | ( | RigidBody * | body | ) |
Register a rigid body so it participates in simulation and collision.
Definition at line 67 of file PhysicsManager.cpp.
References mnd::RigidBody::GetBody(), and mnd::RigidBody::SetAddedToWorld().
Referenced by mnd::PhysicsComponent::Init().
| btDiscreteDynamicsWorld * mnd::PhysicsManager::GetWorld | ( | ) |
Raw pointer to the underlying Bullet world (for advanced/internal use).
Definition at line 95 of file PhysicsManager.cpp.
Referenced by mnd::KinematicCharacterController::KinematicCharacterController(), and mnd::KinematicCharacterController::~KinematicCharacterController().
| void mnd::PhysicsManager::Init | ( | ) |
Allocate broadphase, dispatcher, solver, and dynamics world. Call once.
Definition at line 17 of file PhysicsManager.cpp.
References kGravity.
Referenced by mnd::Engine::Init().
Cast a ray from from to to and fill out with the closest hit. out.object is the GameObject behind the hit collision object, when one has been set via CollisionObject::SetOwner; otherwise null.
Definition at line 100 of file PhysicsManager.cpp.
References mnd::RayHit::fraction, mnd::RayHit::normal, mnd::RayHit::object, and mnd::RayHit::point.
| void mnd::PhysicsManager::RemoveRigidBody | ( | RigidBody * | body | ) |
Unregister a rigid body (e.g. when its owning component is destroyed).
Definition at line 81 of file PhysicsManager.cpp.
References mnd::RigidBody::GetBody(), and mnd::RigidBody::SetAddedToWorld().
Referenced by mnd::RigidBody::~RigidBody().
| void mnd::PhysicsManager::Update | ( | float | deltaTime | ) |
Step the simulation by deltaTime seconds.
Definition at line 30 of file PhysicsManager.cpp.
References kFixedTimeStep, and kMaxSubSteps.
Referenced by mnd::Engine::Run().