diff options
Diffstat (limited to 'scene/2d/collision_shape_2d.cpp')
-rw-r--r-- | scene/2d/collision_shape_2d.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 18426c088d..db9a745436 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -59,34 +59,28 @@ void CollisionShape2D::_notification(int p_what) { } _update_in_shape_owner(); } - - /*if (Engine::get_singleton()->is_editor_hint()) { - //display above all else - set_z_as_relative(false); - set_z_index(RS::CANVAS_ITEM_Z_MAX - 1); - }*/ - } break; + case NOTIFICATION_ENTER_TREE: { if (parent) { _update_in_shape_owner(); } - } break; + case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (parent) { _update_in_shape_owner(true); } - } break; + case NOTIFICATION_UNPARENTED: { if (parent) { parent->remove_shape_owner(owner_id); } owner_id = 0; parent = nullptr; - } break; + case NOTIFICATION_DRAW: { ERR_FAIL_COND(!is_inside_tree()); @@ -121,15 +115,15 @@ void CollisionShape2D::_notification(int p_what) { } Vector2 line_to(0, 20); draw_line(Vector2(), line_to, draw_col, 2); - Vector<Vector2> pts; real_t tsize = 8; - pts.push_back(line_to + (Vector2(0, tsize))); - pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0))); - pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0))); - Vector<Color> cols; - for (int i = 0; i < 3; i++) { - cols.push_back(draw_col); - } + + Vector<Vector2> pts{ + line_to + Vector2(0, tsize), + line_to + Vector2(Math_SQRT12 * tsize, 0), + line_to + Vector2(-Math_SQRT12 * tsize, 0) + }; + + Vector<Color> cols{ draw_col, draw_col, draw_col }; draw_primitive(pts, cols, Vector<Vector2>()); } |