summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/plugins/collision_polygon_editor_plugin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
index 381cfd74ab..60683f4eda 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);