Selaa lähdekoodia

casting line into physics on negative space now works properly, fixes #1726

Juan Linietsky 10 vuotta sitten
vanhempi
commit
f971ae32e1
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4 3
      servers/physics_2d/broad_phase_2d_hash_grid.cpp

+ 4 - 3
servers/physics_2d/broad_phase_2d_hash_grid.cpp

@@ -467,9 +467,10 @@ int BroadPhase2DHashGrid::cull_segment(const Vector2& p_from, const Vector2& p_t
 	delta.x=cell_size/delta.x;
 	delta.y=cell_size/delta.y;
 
-	Point2i pos = p_from.floor() / cell_size;
-	Point2i end = p_to.floor() / cell_size;
-	Point2i step = Vector2( SGN(dir.x), SGN(dir.y));
+	Point2i pos = (p_from/cell_size).floor();
+	Point2i end = (p_to/cell_size).floor();
+
+	Point2i step = Vector2( SGN(dir.x), SGN(dir.y) );
 
 	Vector2 max;