diff options
Diffstat (limited to 'editor/spatial_editor_gizmos.cpp')
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index f540b386aa..67cbcf5de4 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -58,6 +58,7 @@ #include "scene/resources/concave_polygon_shape.h" #include "scene/resources/convex_polygon_shape.h" #include "scene/resources/cylinder_shape.h" +#include "scene/resources/height_map_shape.h" #include "scene/resources/plane_shape.h" #include "scene/resources/primitive_meshes.h" #include "scene/resources/ray_shape.h" @@ -571,9 +572,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 +585,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); @@ -3635,6 +3638,14 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { handles.push_back(Vector3(0, 0, rs->get_length())); p_gizmo->add_handles(handles, handles_material); } + + if (Object::cast_to<HeightMapShape>(*s)) { + + Ref<HeightMapShape> hms = s; + + Ref<ArrayMesh> mesh = hms->get_debug_mesh(); + p_gizmo->add_mesh(mesh, false, RID(), material); + } } ///// |