Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
Collider.h
Go to the documentation of this file.
1/**
2 * @file Collider.h
3 * @ingroup mnd_physics
4 * @brief Thin RAII wrappers around Bullet collision shapes.
5 */
6
7#pragma once
8
9#include <glm/vec3.hpp>
10
11class btCollisionShape;
12
13namespace mnd
14{
15/**
16 * @ingroup mnd_physics
17 * @brief Abstract owner of a `btCollisionShape`.
18 *
19 * Subclass constructors allocate a concrete Bullet shape; the destructor
20 * releases it. Attach to a @ref RigidBody to give it geometry.
21 */
23{
24public:
25 virtual ~Collider();
26
27 /// Underlying Bullet shape (borrowed, do not delete).
28 btCollisionShape *GetShape();
29
30protected:
31 btCollisionShape *m_shape = nullptr;
32};
33
34/**
35 * @ingroup mnd_physics
36 * @brief Axis-aligned box collider; @p extents are *half*-sizes.
37 */
38class BoxCollider : public Collider
39{
40public:
41 BoxCollider(const glm::vec3 &extents);
42};
43
44/**
45 * @ingroup mnd_physics
46 * @brief Sphere collider of the given @p radius.
47 */
49{
50public:
51 SphereCollider(float radius);
52};
53
54/**
55 * @ingroup mnd_physics
56 * @brief Y-axis capsule collider (cylinder + hemispherical caps).
57 */
59{
60public:
61 CapsuleCollider(float radius, float height);
62};
63} // namespace mnd
64
Axis-aligned box collider; extents are half-sizes.
Definition Collider.h:39
Y-axis capsule collider (cylinder + hemispherical caps).
Definition Collider.h:59
Abstract owner of a btCollisionShape.
Definition Collider.h:23
btCollisionShape * GetShape()
Underlying Bullet shape (borrowed, do not delete).
Definition Collider.cpp:17
btCollisionShape * m_shape
Definition Collider.h:31
virtual ~Collider()
Definition Collider.cpp:9
Sphere collider of the given radius.
Definition Collider.h:49