RavEngine
Loading...
Searching...
No Matches
PhysicsCallback.hpp
1#pragma once
2#include "WeakRef.hpp"
3#include "DataStructures.hpp"
4#include "ComponentHandle.hpp"
5#include "Types.hpp"
6#include "Function.hpp"
7
11namespace RavEngine {
12 class PhysicsBodyComponent;
13 struct ContactPairPoint;
14
22 Function<void(PhysicsBodyComponent& other, const ContactPairPoint* contactPoints, size_t numContactPoints)> OnColliderEnter;
23
30 Function<void(PhysicsBodyComponent& other, const ContactPairPoint* contactPoints, size_t numContactPoints)> OnColliderExit;
31
38 Function<void(PhysicsBodyComponent& other, const ContactPairPoint* contactPoints, size_t numContactPoints)> OnColliderPersist;
39
45
51
53 senders.insert(sender);
54 }
56 senders.erase(sender);
57 }
58
59 // invoked automatically on component destruction
60 ~PhysicsCallback();
61
62 private:
63 UnorderedSet<PolymorphicComponentHandle<PhysicsBodyComponent>> senders;
64 entity_t owner;
65 };
66}
67
68namespace RavEngine {
69 // manual specializations for this non-autogeneratable type
70 template<>
71 inline std::string_view type_name<PhysicsCallback>() {
72 return "PhysicsCallback";
73 }
74}
Definition PhysicsBodyComponent.hpp:41
Definition concurrentqueue.h:747
Definition Animation.hpp:6
Definition Types.hpp:10
Definition PhysicsBodyComponent.hpp:21
Definition PhysicsCallback.hpp:15
Function< void(PhysicsBodyComponent &)> OnTriggerEnter
Definition PhysicsCallback.hpp:44
Function< void(PhysicsBodyComponent &other, const ContactPairPoint *contactPoints, size_t numContactPoints)> OnColliderPersist
Definition PhysicsCallback.hpp:38
Function< void(PhysicsBodyComponent &other, const ContactPairPoint *contactPoints, size_t numContactPoints)> OnColliderExit
Definition PhysicsCallback.hpp:30
Function< void(PhysicsBodyComponent &)> OnTriggerExit
Definition PhysicsCallback.hpp:50
Function< void(PhysicsBodyComponent &other, const ContactPairPoint *contactPoints, size_t numContactPoints)> OnColliderEnter
Definition PhysicsCallback.hpp:22