summaryrefslogtreecommitdiff
path: root/servers/physics/collision_object_sw.h
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-12 13:17:26 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-12 13:17:26 +0200
commite07266f6c1177d963f015fa108af40a315305f89 (patch)
treefa11077b94d83f3ce5d677bce45e96a8195ba2c3 /servers/physics/collision_object_sw.h
parent29ed58eab698334bcfc06c808406c054b06614a3 (diff)
parentf7c3d6329cdc9c21c205f1522813090313a422d2 (diff)
Merge pull request #4273 from bojidar-bg/add-layers-and-masks-to-3d
Port collision and layer masks to 3D
Diffstat (limited to 'servers/physics/collision_object_sw.h')
-rw-r--r--servers/physics/collision_object_sw.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index 592c84e667..bc71c2709b 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -53,6 +53,7 @@ private:
RID self;
ObjectID instance_id;
uint32_t layer_mask;
+ uint32_t collision_mask;
struct Shape {
@@ -136,6 +137,13 @@ public:
_FORCE_INLINE_ void set_layer_mask(uint32_t p_mask) { layer_mask=p_mask; }
_FORCE_INLINE_ uint32_t get_layer_mask() const { return layer_mask; }
+ _FORCE_INLINE_ void set_collision_mask(uint32_t p_mask) { collision_mask=p_mask; }
+ _FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; }
+
+ _FORCE_INLINE_ bool test_collision_mask(CollisionObjectSW* p_other) const {
+ return layer_mask&p_other->collision_mask || p_other->layer_mask&collision_mask;
+ }
+
void remove_shape(ShapeSW *p_shape);
void remove_shape(int p_index);