|
Monad Engine da02fba2
> Undercity Codex_
|
Owning wrapper around btRigidBody; holds a shared Collider, mass, friction, and body type.
More...
#include <RigidBody.h>
Inheritance diagram for mnd::RigidBody:
Collaboration diagram for mnd::RigidBody:Public Member Functions | |
| RigidBody (BodyType type, const std::shared_ptr< Collider > &collider, float mass, float friction) | |
| ~RigidBody () | |
| btRigidBody * | GetBody () |
| Underlying Bullet body (borrowed, do not delete). | |
| void | SetAddedToWorld (bool added) |
| Track whether this body is currently registered with a PhysicsManager. | |
| bool | IsAddedToWorld () const |
| BodyType | GetType () const |
| void | SetPosition (const glm::vec3 &pos) |
| Teleport the body (bypasses the solver — use sparingly on Dynamic bodies). | |
| glm::vec3 | GetPosition () const |
| void | SetRotation (const glm::quat &rot) |
| glm::quat | GetRotation () const |
| void | ApplyImpulse (const vec3 &impulse) |
| void | EnableCcd (float motionThreshold, float sweptRadius) |
| CollisionObjectType | GetCollisionObjectType () |
| void | AddContactListener (IContactListener *listener) |
| void | RemoveContactListener (IContactListener *listener) |
| void | SetOwner (GameObject *owner) |
| GameObject * | GetOwner () const |
Protected Member Functions | |
| void | DispatchContactEvent (CollisionObject *obj, const vec3 &pos, const vec3 &norm) |
Protected Attributes | |
| CollisionObjectType | m_collisionObjType |
| std::vector< IContactListener * > | m_contactListeners |
| GameObject * | m_owner = nullptr |
Owning wrapper around btRigidBody; holds a shared Collider, mass, friction, and body type.
Definition at line 40 of file RigidBody.h.
| mnd::RigidBody::RigidBody | ( | BodyType | type, |
| const std::shared_ptr< Collider > & | collider, | ||
| float | mass, | ||
| float | friction | ||
| ) |
| type | Simulation category. |
| collider | Shape used for collision (shared — the same Collider may back several bodies). |
| mass | Kilograms; ignored for Static bodies. |
| friction | Bullet friction coefficient in [0, 1]. |
Definition at line 12 of file RigidBody.cpp.
References mnd::Dynamic, mnd::Kinematic, mnd::CollisionObject::m_collisionObjType, and mnd::RigidBody.
| mnd::RigidBody::~RigidBody | ( | ) |
Definition at line 50 of file RigidBody.cpp.
References mnd::Engine::GetInstance(), mnd::Engine::GetPhysicsManager(), and mnd::PhysicsManager::RemoveRigidBody().
|
inherited |
Definition at line 13 of file CollisionObject.cpp.
References mnd::CollisionObject::m_contactListeners.
| void mnd::RigidBody::ApplyImpulse | ( | const vec3 & | impulse | ) |
Definition at line 130 of file RigidBody.cpp.
|
protectedinherited |
Definition at line 35 of file CollisionObject.cpp.
References mnd::CollisionObject::m_contactListeners.
| void mnd::RigidBody::EnableCcd | ( | float | motionThreshold, |
| float | sweptRadius | ||
| ) |
Enable continuous collision detection (prevents tunneling for fast bodies). motionThreshold: velocity per step above which CCD kicks in (set < expected step distance). sweptRadius: embedded sphere radius used for the swept test (typically ~0.2× shape radius).
Definition at line 139 of file RigidBody.cpp.
| btRigidBody * mnd::RigidBody::GetBody | ( | ) |
Underlying Bullet body (borrowed, do not delete).
Definition at line 58 of file RigidBody.cpp.
Referenced by mnd::PhysicsManager::AddRigidBody(), and mnd::PhysicsManager::RemoveRigidBody().
|
inherited |
Definition at line 8 of file CollisionObject.cpp.
References mnd::CollisionObject::m_collisionObjType.
|
inlineinherited |
Definition at line 31 of file CollisionObject.h.
References mnd::CollisionObject::m_owner.
| glm::vec3 mnd::RigidBody::GetPosition | ( | ) | const |
Definition at line 94 of file RigidBody.cpp.
| glm::quat mnd::RigidBody::GetRotation | ( | ) | const |
Definition at line 120 of file RigidBody.cpp.
| BodyType mnd::RigidBody::GetType | ( | ) | const |
Definition at line 73 of file RigidBody.cpp.
| bool mnd::RigidBody::IsAddedToWorld | ( | ) | const |
Definition at line 68 of file RigidBody.cpp.
|
inherited |
Definition at line 26 of file CollisionObject.cpp.
References mnd::CollisionObject::m_contactListeners.
| void mnd::RigidBody::SetAddedToWorld | ( | bool | added | ) |
Track whether this body is currently registered with a PhysicsManager.
Definition at line 63 of file RigidBody.cpp.
Referenced by mnd::PhysicsManager::AddRigidBody(), and mnd::PhysicsManager::RemoveRigidBody().
|
inlineinherited |
Backref to the owning GameObject so raycast hits can resolve to scene objects without a separate map. Set by PhysicsComponent / KCC owner.
Definition at line 30 of file CollisionObject.h.
References mnd::CollisionObject::m_owner.
| void mnd::RigidBody::SetPosition | ( | const glm::vec3 & | pos | ) |
Teleport the body (bypasses the solver — use sparingly on Dynamic bodies).
Definition at line 78 of file RigidBody.cpp.
| void mnd::RigidBody::SetRotation | ( | const glm::quat & | rot | ) |
Definition at line 104 of file RigidBody.cpp.
|
protectedinherited |
Definition at line 36 of file CollisionObject.h.
Referenced by mnd::KinematicCharacterController::KinematicCharacterController(), RigidBody(), and mnd::CollisionObject::GetCollisionObjectType().
|
protectedinherited |
Definition at line 37 of file CollisionObject.h.
Referenced by mnd::CollisionObject::AddContactListener(), mnd::CollisionObject::DispatchContactEvent(), and mnd::CollisionObject::RemoveContactListener().
|
protectedinherited |
Definition at line 38 of file CollisionObject.h.
Referenced by mnd::CollisionObject::GetOwner(), and mnd::CollisionObject::SetOwner().