Quellcode durchsuchen

Properly update node after clearing shapes in _update_shapes_from_children()
(fix bug causing eg. CircleShape2D.set_radius to generate multiple shapes)

Fabio Alessandrelli vor 9 Jahren
Ursprung
Commit
3eba84e1d7
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 2 2
      scene/2d/collision_object_2d.cpp
  2. 2 2
      scene/3d/collision_object.cpp

+ 2 - 2
scene/2d/collision_object_2d.cpp

@@ -32,14 +32,14 @@
 
 void CollisionObject2D::_update_shapes_from_children() {
 
-	shapes.resize(0);
+	shapes.clear();
 	for(int i=0;i<get_child_count();i++) {
 
 		Node* n = get_child(i);
 		n->call("_add_to_collision_object",this);
 	}
 
-//	_update_shapes();
+	_update_shapes();
 }
 
 void CollisionObject2D::_notification(int p_what) {

+ 2 - 2
scene/3d/collision_object.cpp

@@ -31,14 +31,14 @@
 #include "scene/scene_string_names.h"
 void CollisionObject::_update_shapes_from_children() {
 
-	shapes.resize(0);
+	shapes.clear();
 	for(int i=0;i<get_child_count();i++) {
 
 		Node* n = get_child(i);
 		n->call("_add_to_collision_object",this);
 	}
 
-//	_update_shapes();
+	_update_shapes();
 }
 
 void CollisionObject::_notification(int p_what) {