diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_settings.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index d4ee6b2d17..e5fbf7915d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -677,6 +677,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("editors/3d/orbit_sensitivity", 0.4); + set("editors/3d/zoom_inertia", 0.1); + hints["editors/3d/zoom_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/zoom_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01"); + set("editors/3d/orbit_inertia", 0.2); hints["editors/3d/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01"); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index a6ab36ed27..f50e792178 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -83,6 +83,8 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) { float manip_orbit_inertia = EDITOR_DEF("editors/3d/manipulation_orbit_inertia", 0.075); float manip_translation_inertia = EDITOR_DEF("editors/3d/manipulation_translation_inertia", 0.075); + float zoom_inertia = EDITOR_DEF("editors/3d/zoom_inertia", 0.0); + //determine if being manipulated bool manipulated = (Input::get_singleton()->get_mouse_button_mask() & (2 | 4)) || Input::get_singleton()->is_key_pressed(KEY_SHIFT) || Input::get_singleton()->is_key_pressed(KEY_ALT) || Input::get_singleton()->is_key_pressed(KEY_CONTROL); @@ -96,7 +98,7 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) { camera_cursor.y_rot = Math::lerp(old_camera_cursor.y_rot, cursor.y_rot, MIN(1.f, p_interp_delta * (1 / orbit_inertia))); camera_cursor.pos = old_camera_cursor.pos.linear_interpolate(cursor.pos, MIN(1.f, p_interp_delta * (1 / translation_inertia))); - camera_cursor.distance = Math::lerp(old_camera_cursor.distance, cursor.distance, MIN(1.f, p_interp_delta * (1 / translation_inertia))); + camera_cursor.distance = Math::lerp(old_camera_cursor.distance, cursor.distance, MIN(1.f, p_interp_delta * (1 / zoom_inertia))); if (p_interp_delta == 0 || is_freelook_active()) { camera_cursor = cursor; |