From 207feb2f879058eb972b73e0220c34422e467b27 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Sun, 25 Jun 2017 21:47:30 +0300 Subject: Add one-way collisions and individual shape offsets for tilesets As requested in #9318 Accidentially fixes #2231 as well --- editor/plugins/tile_set_editor_plugin.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'editor/plugins/tile_set_editor_plugin.cpp') diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 14b25681b..b1ba8d839 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -111,22 +111,17 @@ void TileSetEditor::_import_node(Node *p_node, Ref p_library) { for (List::Element *E = shapes.front(); E; E = E->next()) { + Vector2 shape_offset = sb->shape_owner_get_transform(E->get()).get_origin(); + bool one_way = sb->is_shape_owner_one_way_collision_enabled(E->get()); + for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) { Ref shape = sb->shape_owner_get_shape(E->get(), k); - collisions.push_back(shape); //uh what about transform? + p_library->tile_add_shape(id, shape, shape_offset, one_way); } } } - if (collisions.size()) { - - p_library->tile_set_shapes(id, collisions); - p_library->tile_set_shape_offset(id, -phys_offset); - } else { - p_library->tile_set_shape_offset(id, Vector2()); - } - p_library->tile_set_texture_offset(id, mi->get_offset()); p_library->tile_set_navigation_polygon(id, nav_poly); p_library->tile_set_light_occluder(id, occluder); -- cgit v1.2.3-70-g09d2