diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-06-26 22:47:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 22:47:26 +0200 |
commit | f2bc0cc96663bbdde872c2a4d9a29f2218ff7d22 (patch) | |
tree | 0a5208df19f37c66d63853bcf02579f5efd2a877 /editor/plugins | |
parent | f7b77e5b76639dbc2e7a770cc57b64fc02a1e075 (diff) | |
parent | 207feb2f879058eb972b73e0220c34422e467b27 (diff) |
Merge pull request #9370 from bojidar-bg/c-9318-oneway-tilemaps
Add one-way collisions and individual shape offsets for tilesets
Diffstat (limited to 'editor/plugins')
-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 aa579ae45c..70b6257bb2 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -113,22 +113,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); |