From f971ae32e1f16e453afdc4fd11cb29f8f3b0cf2a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 24 Apr 2015 22:41:31 -0300 Subject: [PATCH] casting line into physics on negative space now works properly, fixes #1726 --- servers/physics_2d/broad_phase_2d_hash_grid.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index e5f9c347a77..4651d485c2e 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/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;