diff options
| author | Marc Gilleron | 2017-08-19 21:57:43 +0200 |
|---|---|---|
| committer | Marc Gilleron | 2017-08-19 21:57:43 +0200 |
| commit | a88c759ff180ae6c3ed12f5c8138f9c883e66d29 (patch) | |
| tree | 4390942d882dd8d512968edcc4bd918ba86d340c /editor/plugins/spatial_editor_plugin.cpp | |
| parent | 588ffbc08aaf7d1fa30163f46702d56e032de04a (diff) | |
| download | godot-a88c759ff180ae6c3ed12f5c8138f9c883e66d29.tar.gz godot-a88c759ff180ae6c3ed12f5c8138f9c883e66d29.tar.zst godot-a88c759ff180ae6c3ed12f5c8138f9c883e66d29.zip | |
Added option for mouse orbit sensitivity
Diffstat (limited to 'editor/plugins/spatial_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 5faacf7a6..41fb27592 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) |
