diff options
author | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2016-04-09 21:54:09 +0300 |
---|---|---|
committer | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2016-04-09 22:11:12 +0300 |
commit | f7c3d6329cdc9c21c205f1522813090313a422d2 (patch) | |
tree | b4ad305e45bf2d66f5e3a8d35aa36948a2f20c5a /servers/physics/collision_object_sw.h | |
parent | d454e64f429affb89de036eed6daa5c6e5278492 (diff) |
Port collision and layer masks to 3D, fixes #1759
Raycasts now have type_mask and layer_mask. Areas - collision_mask and layer_mask. PhysicsBodies needed only collision_mask.
Diffstat (limited to 'servers/physics/collision_object_sw.h')
-rw-r--r-- | servers/physics/collision_object_sw.h | 8 |
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); |