Search Unity

New editor camera controls in 2019.1 are great, but...

Discussion in 'Editor & General Support' started by Fewes, Apr 19, 2019.

  1. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    259
    Please, make the scroll wheel change the speed exponentially, let us turn off acceleration, and remove the arbitrary speed cap at 99x. Even though 99 seems high, some of us work in huge scenes and need to quickly zoom around them.

    An example of why the linear change in speed is a problem is that when I have it set to 0.5x, one scroll tick will take me up to 3.5x, a 600% increase, but when I'm at 66x, it will take me to 68x, which is only a ~3% change! This means that if I tweak something at a small level and want to move to another area of my scene, I have to scroll like crazy to go from 0.5x to 99x. On the other end, if I have the speed set high and I'm approaching an area I would like to work in, the camera will grind to a complete stop because it is impossible to know how many scroll ticks will bring it down to a reasonable "local" speed.
    To further complicate things, the acceleration kicks in halfway and makes it very hard to end up where I want.
    Now, I understand the idea behind the acceleration, but it is much better to allow the user to control the speed themselves, and set up the multipliers to fit their game type.
    I previously used an editor script I had created myself which did exactly this, but the new update to the scene camera broke it. From testing I can tell you that multiplying the camera speed with 1.5 for up and 0.75 for down feels very easy to control.

    This stuff is so rudimentary to implement, yet it has a huge impact on editor workflow. If you don't want to confuse the user with too many variables, please hide it in the editor preferences.
    Also please note that when I say acceleration, I am not talking about the "camera easing" feature. I am talking about the hidden acceleration that kicks in after you've moved the camera for a few seconds.
    I also noticed that there is a SceneView.CameraSettings class. Unfortunately the variables don't seem to be exposed to script, which is a shame.

    Big props to the Unity team for finally getting on this, but it still has ways to go.
     
    Last edited: Apr 19, 2019
  2. frarf

    frarf

    Joined:
    Nov 23, 2017
    Posts:
    27
    Please. Camera acceleration is so annoying, I thought 2019.1 would be the update to fix this (with "camera easing") but I was seriously wrong. At least have it as a toggle.
     
  3. Hunter_Bobeck

    Hunter_Bobeck

    Joined:
    Dec 9, 2015
    Posts:
    4
    The more options the better.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    I'm not sure whether it helps, but when I'm zooming in/out significantly in the scene view, I almost always use alt-rmb + drag for quick movement. I believe it's still based on the same increment as the scroll wheel, but I always feel like it moves much faster than I can get with the mouse wheel.
     
  5. JonPQ

    JonPQ

    Joined:
    Aug 10, 2016
    Posts:
    120
    Is there a way to turn off the acceleration and/or momentum in the 2019 editor camera controls? There must be an option somewhere ?
    for every editor camera move, I now have to wait... and re adjust position after it moves too far or not far enough.... I would really like to just turn this off please. It wastes my time.
     
  6. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Did you try adjusting the stuff in this menu? Maybe you want to turn off Easing.

    upload_2019-7-25_15-4-56.png
     
    Dejv311, Wattosan, G76Dev and 5 others like this.
  7. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    I actually am the creator of an asset, Snapcam: NAVIGATION STUDIO which aims to fix scene camera controls with its View Navigator.

    The pre-2019 version of my asset did a great job of this, however Unity's bizarre acceleration has always been an issue, and is a particular pain point in 2019.1 since it requires me to rewrite Unity's entire scene camera controller (AGAIN) to fix just a few issues.


    These issues include:

    • Acceleration -- It sucks because there is no maximum speed your camera can accelerate before it stops -- I have to stop, then move forward again (slowwwly) until the speed becomes too fast/unbearable to be useful again.

    • Orbiting -- Doing this around a selected object sucks because Alt+RMB doesn't orbit the center of the selected object. Also, it should be SHIFT+RMB as the shortcut (but THIS should be configurable!!)

    • Zooming -- This still sucks because I can't zoom forever forward (at a steady pace I can set) for straight movement, while also zooming into the current object's center when a gameobject is selected (and I am holding a modifier key because SOMETIMES I don't want to zoom into the object's center).


    If Unity would just be willing to allow me to override all of their scene camera controller's functionality (or just let me make my own), I would fix these issues myself!

    I could then tweak it to my (and my users') needs. I wouldn't need to jump through hoops with crazy reflection magic just to get a usable UI / UX experience with the scene camera controller!!

    Any chance of this happening, @willgoldstone?


    Like you guys, I thought 2019.1 had finally fixed scene camera controls. I was clearly wrong.
     
    Last edited: Jul 28, 2019
    joshcamas likes this.
  8. JonPQ

    JonPQ

    Joined:
    Aug 10, 2016
    Posts:
    120
    Thanks much ! will give that a try :)
    Yeah the momentum is terrible, camera keeps moving after I let go.. and if I tap to move forwards a little at a time... it moves different speeds. not useful.
    Cheers ! this should help.

    Update:-
    Yep, its much more precise with the easing turned off. Thanks

    It should maybe have 2 check-boxes... one for ease-in (acceleration) and one for ease-out (deceleration, when you let go of input) and a different float tweak value for each.
     
    Last edited: Aug 1, 2019
  9. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Unity 2019.3 comes with settings to adjust camera acceleration and deceleration. It can be turned off too. Perhaps it was even 2019.2, can't remember exactly.
     
  10. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Looks like this is present in 2019.2 -- yay! :)


    I still want to use IShortcutToolContext in my shortcuts like Unity is able to. :/

    It's not possible to add any interactive scene controls without this.
    For example, if I want to add my own camera orbit behavior or a gradual position/rotation modifier via keystrokes for a gameobject -- I can't.
    Lots of cool tools will never be possible to create thanks to the new shortcut system without access to this feature.
     
  11. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    794
    Hey @awesomedata did you try 19.3 to see if it resolves what you need ?
     
  12. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Sorry for the delay, @willgoldstone, but I'm still digging into 2019.3 to try to understand which issues you're referring to.


    I still see the flythrough camera controller and all related controls/methods are internal and none of the methods or classes are able to be overridden, interfaced with, or added onto (or even disabled so one can write their own camera controller with better orbit). Also none of the orbit/zoom issues mentioned above are fixed in 2019.3b3 either.

    Also the IShortcutToolContext is also still internal, so I still see no way to handle global shortcuts that can be both assigned via the ShortcutManager that also activate independent of the keyboard repeat rate. For example, holding R or G keys to gradually update a value (or to tweak the camera orbit method to orbit around an object in the SceneView) all without waiting for the Windows repeat rate to kick in since I want it to happen instantaneously (while also using the shortcut manager to let the tool user assign their keys to the method being executed so that I don't have to program my own shortcut system for Unity to handle tools like scene camera controls.)



    The more you give users freedom to deal with realtime input to manage things in the editor itself, the more innovative and useful tools you'll find being created. And realtime tools are all the rage right now (as you're probably finding with the Terrain Editor), so it'd be a great time for it.
     
    Last edited: Sep 11, 2019
    willgoldstone and varfare like this.
  13. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,876
    I guess I'm in the minority here but I was very used to zooming with the mouse wheel while holding the right mouse button (I rotate the camera with right mouse button and in the meantime, zoom in/zoom out as necessary with the mouse wheel). Now the mouse wheel changes the movement speed which is not what I am used to.

    Is it possible to restore the old behaviour with a simple toggle or should I write an editor script for it?

    P.S. I know that I can zoom in/zoom out by simply releasing the right mouse button or use ALT+Left mouse button to orbit around an object, I was just used to the old behaviour of
    right mouse button+mouse wheel
    combination, so please don't recommend me to just get used to the new behaviour.
     
    Last edited: Jun 16, 2021
  14. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    It sounds easy, but I've done this before (pre-2019) for my asset, Snapcam, and have been looking into writing my own editor scripts for changing the new 2019 camera behavior too, but this is proving even more tedious than pre-2019. Although it's 'possible' to write your own scene view camera behaviors, on some level you will still have to rewrite the scene camera controller from scratch just to somewhat 'tweak' the default camera behavior (while also being unable to disable anything from the current scene camera controller's behaviors).

    This means you have to cancel-out each and every behavior (and every shortcut) you don't want or just want to modify from Unity's scene camera controller that might conflict with your behavior. This is impossible in some cases, and unwieldy in others. And in the case of mouse usage to modify the scene camera in general, this is a MAJOR pain because of how Unity handles its shortcuts and mouse events under the hood to modify the SceneView's camera controller internally.

    :(

    Unity should let us extend and override everything and anything on the existing Scene CameraController so that making the scene camera behave as _you_ want it is possible, while also making it behave as _I_ want it to is possible as well...

    @willgoldstone -- Any chance this is in the cards?
     
    Last edited: Sep 18, 2019
    a436t4ataf, varfare and yasirkula like this.
  15. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,876
    @awesomedata Lucky for me, it was actually very simple to change the mouse wheel's behaviour with this editor script:

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. [InitializeOnLoad]
    5. public class EditorCameraTest
    6. {
    7.     private const float CAMERA_SPEED = -0.25f;
    8.  
    9.     private static bool rmbDown = false;
    10.  
    11.     static EditorCameraTest()
    12.     {
    13.         SceneView.beforeSceneGui -= OnScene;
    14.         SceneView.beforeSceneGui += OnScene;
    15.     }
    16.  
    17.     private static void OnScene( SceneView scene )
    18.     {
    19.         Event e = Event.current;
    20.         if( e.isMouse && e.button == 1 )
    21.         {
    22.             if( e.type == EventType.MouseDown )
    23.                 rmbDown = true;
    24.             else if( e.type == EventType.MouseUp )
    25.                 rmbDown = false;
    26.         }
    27.        
    28.         if( e.isScrollWheel && rmbDown )
    29.         {
    30.             Vector3 pivot = scene.pivot;
    31.             pivot += scene.camera.transform.forward * ( e.delta.y * CAMERA_SPEED );
    32.             scene.pivot = pivot;
    33.  
    34.             e.Use();
    35.         }
    36.     }
    37. }
     
    PutridEx, armaan8014, Neonage and 3 others like this.
  16. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Thanks for posting your code. Although the RMB "Tool" still executes, it's cool to note that stops some default events from happening at least.

    Now how to move the camera properly with the WASD keys (without the keyboard repeat rate interfering) using the Shortcut Manager... That's the real challenge...
     
  17. Sheynes

    Sheynes

    Joined:
    Mar 27, 2017
    Posts:
    66
    Hello,
    I'm trying to use unity 2019. But since i'm used of the old shortcuts, this window is preventing me to scroll everytime i change my view direction in the scene view, and it's super boring. See here :
    https://gyazo.com/8d617fd8d404f437d4e6314ba2fd9054

    I've tryed to change it in the shortcut section of unity, but it is not here.

    Are you aware of a way to remove this window so I can navigate correctly, just like in the old unity versions ?

    Thank you
     
  18. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Are you using WASD + RMB to navigate? If so, do you think it is a bug with the shortcuts themselves? I know single-letter keys don't have the instant repetition they used to.
    Now single letter keys repeat at the rate of the OS (after a delay). Perhaps that is the issue?

    What version of the 2019.x editor are you using?
     
  19. Maxeaman

    Maxeaman

    Joined:
    May 1, 2020
    Posts:
    14
    I was having problems with this and I just turned off acceleration and easing made the min and max camera speed close to the same and the problem stopped immediately. Huge help.
     
    trombonaut likes this.
  20. StupydHors

    StupydHors

    Joined:
    Oct 25, 2016
    Posts:
    25

    THIS!!! Thank you so much. Urgh. Why would that remove/override that workflow feature I have no idea.
    I feel as tho not many people need to change their camera speed that often but zooming in while looking around is helpful to everybody no?
     
    yasirkula likes this.
  21. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    259
    Here's my attempt at what I consider much better camera speed behaviour (exponential instead of linear). This makes it way easier to control the camera when moving around and especially when observing objects from up close.

    Unfortunately, for some reason I don't understand, the maximum camera speed is hard capped to 99. I think it would be wonderful if Unity could remove these arbitrary limits. That would make the editor workflow much better for us working in big worlds with floating origins (if you are afraid of users accidentally setting the camera speed too high, how about something like SceneView.lastActiveSceneView.cameraSettings.limitCameraSpeed = false?).

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. [InitializeOnLoad]
    4. public class BetterEditorCameraSpeed
    5. {
    6.     const float MIN_SPEED = 0.001f;
    7.     const float MAX_SPEED = 10000f;
    8.  
    9.     static bool rmbDown = false;
    10.  
    11.     static BetterEditorCameraSpeed ()
    12.     {
    13.         SceneView.beforeSceneGui -= OnScene;
    14.         SceneView.beforeSceneGui += OnScene;
    15.     }
    16.  
    17.     static void OnScene (SceneView scene)
    18.     {
    19.         Event e = Event.current;
    20.         if (e.isMouse && e.button == 1)
    21.         {
    22.             if( e.type == EventType.MouseDown )
    23.                 rmbDown = true;
    24.             else if( e.type == EventType.MouseUp )
    25.                 rmbDown = false;
    26.         }
    27.    
    28.         if (e.isScrollWheel && rmbDown)
    29.         {
    30.             if (e.delta.y < 0)
    31.                 SceneView.lastActiveSceneView.cameraSettings.speed *= 1.25f; // Exponentially increase the speed
    32.             else
    33.                 SceneView.lastActiveSceneView.cameraSettings.speed *= 0.75f; // Exponentially decrease the speed
    34.  
    35.             // This doesn't appear to do anything because for some ungodly reason the min/max speeds are capped to [0.02, 99]
    36.             SceneView.lastActiveSceneView.cameraSettings.speedMin = MIN_SPEED;
    37.             SceneView.lastActiveSceneView.cameraSettings.speedMax = MAX_SPEED;
    38.  
    39.             SceneView.lastActiveSceneView.cameraSettings.speed = Mathf.Clamp(SceneView.lastActiveSceneView.cameraSettings.speed, MIN_SPEED, MAX_SPEED);
    40.  
    41.             e.Use();
    42.         }
    43.     }
    44. }
     
    PutridEx likes this.
  22. Chrisi12er

    Chrisi12er

    Joined:
    Sep 7, 2014
    Posts:
    9
    I just wrote a little plugin to add the option to change the camera speed exponentially as well. It can be toggled on or off directly inside the camera settings panel including the exact exponential change rate to use. So if somebody wants something like this, give it a try. It's on Github. Feel free to use it however you want.
     
    awesomedata likes this.
  23. armaan8014

    armaan8014

    Joined:
    Jun 13, 2017
    Posts:
    25

    THANK YOU

    For anyone else that doesn't know how to use this script, create a folder named Editor in the Assets folder, and save this script in that folder.
     
    awesomedata and yasirkula like this.