From d6aed94651f43fa4a1a199fbdb2a5881fd79bc33 Mon Sep 17 00:00:00 2001 From: Franklin Sobrinho <franklin_gs@hotmail.com> Date: Mon, 7 Sep 2015 08:20:33 -0300 Subject: [PATCH] Fix for issue #2117 --- tools/editor/plugins/collision_polygon_editor_plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 381cfd74aba..60683f4edae 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -113,6 +113,7 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const return false; Transform gt = node->get_global_transform(); + Transform gi = gt.affine_inverse(); float depth = node->get_depth()*0.5; Vector3 n = gt.basis.get_axis(2).normalized(); Plane p(gt.origin+n*depth,n); @@ -135,6 +136,8 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const if (!p.intersects_ray(ray_from,ray_dir,&spoint)) break; + spoint = gi.xform(spoint); + Vector2 cpoint(spoint.x,spoint.y); cpoint=CanvasItemEditor::get_singleton()->snap_point(cpoint); @@ -349,6 +352,8 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const if (!p.intersects_ray(ray_from,ray_dir,&spoint)) break; + spoint = gi.xform(spoint); + Vector2 cpoint(spoint.x,spoint.y); cpoint=CanvasItemEditor::get_singleton()->snap_point(cpoint);