summaryrefslogtreecommitdiffstats
path: root/scene/2d/collision_shape_2d.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-06-23 23:30:43 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-06-23 23:39:52 -0300
commit6ba1e4677ba15992c750bddffcb9f1eacd1558a1 (patch)
tree78e6c53f5279a76fc589544ad3c241c2648af66b /scene/2d/collision_shape_2d.h
parent683f50bef476fbe630f893876e709ad03348b2c3 (diff)
downloadredot-engine-6ba1e4677ba15992c750bddffcb9f1eacd1558a1.tar.gz
-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 'scene/2d/collision_shape_2d.h')
-rw-r--r--scene/2d/collision_shape_2d.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index 3e63981010..1f2b96b91f 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -33,35 +33,33 @@
#include "scene/2d/node_2d.h"
#include "scene/resources/shape_2d.h"
+class CollisionObject2D;
+
class CollisionShape2D : public Node2D {
- GDCLASS(CollisionShape2D, Node2D);
+ GDCLASS(CollisionShape2D, Node2D)
Ref<Shape2D> shape;
Rect2 rect;
- bool trigger;
- bool unparenting;
- bool can_update_body;
+ uint32_t owner_id;
+ CollisionObject2D *parent;
void _shape_changed();
- int update_shape_index;
-
- void _set_update_shape_index(int p_index);
- int _get_update_shape_index() const;
+ bool disabled;
+ bool one_way_collision;
protected:
- void _update_parent();
void _notification(int p_what);
static void _bind_methods();
- void _add_to_collision_object(Object *p_obj);
-
public:
void set_shape(const Ref<Shape2D> &p_shape);
Ref<Shape2D> get_shape() const;
virtual Rect2 get_item_rect() const;
- void set_trigger(bool p_trigger);
- bool is_trigger() const;
- int get_collision_object_shape_index() const { return _get_update_shape_index(); }
+ void set_disabled(bool p_disabled);
+ bool is_disabled() const;
+
+ void set_one_way_collision(bool p_enable);
+ bool is_one_way_collision_enabled() const;
virtual String get_configuration_warning() const;