summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System/physDefines.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-04-24 11:17:43 +0200
committerLéo Lam <leo@leolam.fr>2021-04-24 11:18:14 +0200
commit6deecbee61272dd4eca68c8b4043096d3ca61322 (patch)
treed9e74da4c985809ff605b5676530af630a39e11f /src/KingSystem/Physics/System/physDefines.cpp
parent2fe382fb1a36de13d05dcb9c379787e0d38bb849 (diff)
ksys/phys: Add isSensorLayer and makeContactLayerMask
Diffstat (limited to 'src/KingSystem/Physics/System/physDefines.cpp')
-rw-r--r--src/KingSystem/Physics/System/physDefines.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/KingSystem/Physics/System/physDefines.cpp b/src/KingSystem/Physics/System/physDefines.cpp
index 03be03a1..f6333608 100644
--- a/src/KingSystem/Physics/System/physDefines.cpp
+++ b/src/KingSystem/Physics/System/physDefines.cpp
@@ -2,6 +2,16 @@
namespace ksys::phys {
+bool isSensorLayer(ContactLayer layer) {
+ return layer > ContactLayer::EntityEnd;
+}
+
+u32 makeContactLayerMask(ContactLayer layer) {
+ if (layer < ContactLayer::SensorObject)
+ return 1 << layer;
+ return 1 << (layer - ContactLayer::SensorObject);
+}
+
const char* contactLayerToText(ContactLayer layer) {
return layer.text();
}