Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
CollisionObject.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "Common.h"
6#include "Types.h"
7
8namespace mnd
9{
10
11class IContactListener;
12class GameObject;
13
19
21{
22 public:
24
27
28 /// Backref to the owning GameObject so raycast hits can resolve to scene
29 /// objects without a separate map. Set by PhysicsComponent / KCC owner.
30 void SetOwner(GameObject *owner) { m_owner = owner; }
31 [[nodiscard]] GameObject *GetOwner() const { return m_owner; }
32
33 protected:
34 void DispatchContactEvent(CollisionObject *obj, const vec3 &pos, const vec3 &norm);
35
37 std::vector<IContactListener *> m_contactListeners;
38 GameObject *m_owner = nullptr;
39
40 friend class PhysicsManager;
41};
42
44{
45 public:
46 virtual void OnContact(CollisionObject *obj, const vec3 &pos, const vec3 &norm) = 0;
47};
48
49} // namespace mnd
Engine-wide primitive type aliases and GLM math imports.
CollisionObjectType m_collisionObjType
void SetOwner(GameObject *owner)
void RemoveContactListener(IContactListener *listener)
CollisionObjectType GetCollisionObjectType()
std::vector< IContactListener * > m_contactListeners
GameObject * GetOwner() const
void AddContactListener(IContactListener *listener)
void DispatchContactEvent(CollisionObject *obj, const vec3 &pos, const vec3 &norm)
Node in the scene graph: a named transform that owns components and children.
Definition GameObject.h:91
virtual void OnContact(CollisionObject *obj, const vec3 &pos, const vec3 &norm)=0
High-level capsule character controller: walks, jumps, detects ground.
Owns the Bullet btDiscreteDynamicsWorld and all auxiliary collision structures (broadphase,...
Owning wrapper around btRigidBody; holds a shared Collider, mass, friction, and body type.
Definition RigidBody.h:41
glm::vec3 vec3
3-component float vector (e.g. world position, RGB colour, normals).
Definition Types.h:51
CollisionObjectType