浏览代码

Allow Creation of Multiple Collision Shapes for Tiles #24003

Peter Oberrauner 6 年之前
父节点
当前提交
657f83148c
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      editor/plugins/tile_set_editor_plugin.cpp

+ 2 - 0
editor/plugins/tile_set_editor_plugin.cpp

@@ -1425,6 +1425,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
 									workspace->update();
 									workspace->update();
 								} else {
 								} else {
 									creating_shape = true;
 									creating_shape = true;
+									edited_collision_shape = Ref<ConvexPolygonShape2D>();
 									current_shape.resize(0);
 									current_shape.resize(0);
 									current_shape.push_back(snap_point(pos));
 									current_shape.push_back(snap_point(pos));
 									workspace->update();
 									workspace->update();
@@ -1444,6 +1445,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
 					} else if (tools[SHAPE_NEW_RECTANGLE]->is_pressed()) {
 					} else if (tools[SHAPE_NEW_RECTANGLE]->is_pressed()) {
 						if (mb.is_valid()) {
 						if (mb.is_valid()) {
 							if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
 							if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+								edited_collision_shape = Ref<ConvexPolygonShape2D>();
 								current_shape.resize(0);
 								current_shape.resize(0);
 								current_shape.push_back(snap_point(shape_anchor));
 								current_shape.push_back(snap_point(shape_anchor));
 								current_shape.push_back(snap_point(shape_anchor + Vector2(current_tile_region.size.x, 0)));
 								current_shape.push_back(snap_point(shape_anchor + Vector2(current_tile_region.size.x, 0)));