diff options
author | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2017-06-25 21:47:30 +0300 |
---|---|---|
committer | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2017-06-25 21:47:30 +0300 |
commit | 207feb2f879058eb972b73e0220c34422e467b27 (patch) | |
tree | bf00875c02f8bdcca1670d9583f1415acd5801bc /editor | |
parent | 515c71422525b15514818b9d586ebf675c17f18c (diff) |
Add one-way collisions and individual shape offsets for tilesets
As requested in #9318
Accidentially fixes #2231 as well
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 14b25681b7..b1ba8d839a 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<TileSet> p_library) { for (List<uint32_t>::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> 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); |