summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-11 09:45:08 +0200
committerGitHub <noreply@github.com>2019-05-11 09:45:08 +0200
commit58c5eb781eed33da16890e310f06c317c5aca619 (patch)
tree474051d2d55ccd2ff806e29508500b43c1a4f65e /editor
parentfea0c8858e53d50bc50b2e9d6aa815540ad0ef3c (diff)
parent70ead9455ffe65abf505fa4b00cc258049be1580 (diff)
Merge pull request #28742 from guilhermefelipecgs/fix_28737
[EditorSpatialGizmo] Fix error in intersect_ray
Diffstat (limited to 'editor')
-rw-r--r--editor/spatial_editor_gizmos.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index f540b386aa..104bac190e 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -571,9 +571,11 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
Transform orig_camera_transform = p_camera->get_camera_transform();
- if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01) {
+ if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01 &&
+ ABS(orig_camera_transform.basis.get_axis(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) {
p_camera->look_at(t.origin, Vector3(0, 1, 0));
}
+
Vector3 c0 = t.xform(Vector3(selectable_icon_size, selectable_icon_size, 0) * scale);
Vector3 c1 = t.xform(Vector3(-selectable_icon_size, -selectable_icon_size, 0) * scale);
@@ -582,7 +584,7 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
p_camera->set_global_transform(orig_camera_transform);
- Rect2 rect(p0, p1 - p0);
+ Rect2 rect(p0, (p1 - p0).abs());
rect.set_position(center - rect.get_size() / 2.0);