diff options
| author | Juan Linietsky | 2017-06-23 23:30:43 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-06-23 23:39:52 -0300 |
| commit | 6ba1e4677ba15992c750bddffcb9f1eacd1558a1 (patch) | |
| tree | 78e6c53f5279a76fc589544ad3c241c2648af66b /servers/physics_2d/collision_object_2d_sw.h | |
| parent | 683f50bef476fbe630f893876e709ad03348b2c3 (diff) | |
| download | godot-6ba1e4677ba15992c750bddffcb9f1eacd1558a1.tar.gz godot-6ba1e4677ba15992c750bddffcb9f1eacd1558a1.tar.zst godot-6ba1e4677ba15992c750bddffcb9f1eacd1558a1.zip | |
-Trigger shapes removed in 2D, they became obsolete long ago when areas could detect their own overlap
-Added ability to disable individual collisionshape/polygon
-Moved One Way Collision to shape, allowing more flexibility
-Changed internals of CollisionObject, shapes are generated from child nodes on the fly, not stored inside any longer.
-Modifying a CollisionPolygon2D on the fly now works, it can even be animated.
Will port this to 3D once well tested. Have fun!
Diffstat (limited to 'servers/physics_2d/collision_object_2d_sw.h')
| -rw-r--r-- | servers/physics_2d/collision_object_2d_sw.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h index f2059e861..5e29132e8 100644 --- a/servers/physics_2d/collision_object_2d_sw.h +++ b/servers/physics_2d/collision_object_2d_sw.h @@ -58,8 +58,12 @@ private: Rect2 aabb_cache; //for rayqueries Shape2DSW *shape; Variant metadata; - bool trigger; - Shape() { trigger = false; } + bool disabled; + bool one_way_collision; + Shape() { + disabled = false; + one_way_collision = false; + } }; Vector<Shape> shapes; @@ -116,8 +120,11 @@ public: _FORCE_INLINE_ Transform2D get_inv_transform() const { return inv_transform; } _FORCE_INLINE_ Space2DSW *get_space() const { return space; } - _FORCE_INLINE_ void set_shape_as_trigger(int p_idx, bool p_enable) { shapes[p_idx].trigger = p_enable; } - _FORCE_INLINE_ bool is_shape_set_as_trigger(int p_idx) const { return shapes[p_idx].trigger; } + _FORCE_INLINE_ void set_shape_as_disabled(int p_idx, bool p_disabled) { shapes[p_idx].disabled = p_disabled; } + _FORCE_INLINE_ bool is_shape_set_as_disabled(int p_idx) const { return shapes[p_idx].disabled; } + + _FORCE_INLINE_ void set_shape_as_one_way_collision(int p_idx, bool p_one_way_collision) { shapes[p_idx].one_way_collision = p_one_way_collision; } + _FORCE_INLINE_ bool is_shape_set_as_one_way_collision(int p_idx) const { return shapes[p_idx].one_way_collision; } void set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; } _FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; } |
