zoom inertia uses its own setting (not the same then translation)

This commit is contained in:
toger5 2017-09-19 01:30:14 +02:00
parent 3d06957f12
commit 81245a634b
2 changed files with 6 additions and 1 deletions

View File

@ -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");

View File

@ -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;