summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-08-20 15:24:35 +0200
committerGitHub <noreply@github.com>2017-08-20 15:24:35 +0200
commitdca8df47b48cd04b3f1c2ea99ca7ddc15e84ee37 (patch)
tree25f9e27c6372ad28935741cdfcfbf18409ffc715
parent5627047c32bf20d7fc83998c6ab9899744160175 (diff)
parenta88c759ff180ae6c3ed12f5c8138f9c883e66d29 (diff)
Merge pull request #10460 from Zylann/orbit_sensitivity
Added option for mouse orbit sensitivity
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp16
2 files changed, 14 insertions, 4 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 8494c7199e..a5bc0735c7 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -664,6 +664,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/3d/emulate_3_button_mouse", false);
set("editors/3d/warped_mouse_panning", true);
+ set("editors/3d/orbit_sensitivity", 0.7);
+
set("editors/3d/freelook_base_speed", 1);
set("editors/3d/freelook_activation_modifier", 0);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 5faacf7a67..41fb275922 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1453,8 +1453,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
case NAVIGATION_ORBIT: {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 80.0;
- cursor.y_rot += relative.x / 80.0;
+
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+
+ cursor.x_rot += relative.y * radians_per_pixel;
+ cursor.y_rot += relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)
@@ -1468,8 +1472,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
// It technically works too in ortho, but it's awful for a user due to fov being near zero
if (!orthogonal) {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 120.0;
- cursor.y_rot += relative.x / 120.0;
+
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+
+ cursor.x_rot += relative.y * radians_per_pixel;
+ cursor.y_rot += relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)