From 7ad7f2f6a986fa6598ae10f2bb940e15c3658f44 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 23 Mar 2015 11:31:03 -0300 Subject: android fixes, please test (can' t build android atm) --- scene/2d/collision_polygon_2d.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'scene/2d/collision_polygon_2d.cpp') diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 1c0be60764..049017c0a5 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -33,6 +33,9 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { + if (unparenting) + return; + CollisionObject2D *co = p_obj->cast_to(); ERR_FAIL_COND(!co); @@ -96,6 +99,9 @@ void CollisionPolygon2D::_notification(int p_what) { switch(p_what) { + case NOTIFICATION_ENTER_TREE: { + unparenting=false; + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (!is_inside_tree()) @@ -123,6 +129,11 @@ void CollisionPolygon2D::_notification(int p_what) { } #endif } break; + case NOTIFICATION_UNPARENTED: { + unparenting = true; + _update_parent(); + } break; + } } @@ -203,6 +214,7 @@ CollisionPolygon2D::CollisionPolygon2D() { aabb=Rect2(-10,-10,20,20); build_mode=BUILD_SOLIDS; trigger=false; + unparenting=false; } -- cgit v1.2.3