-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement FPS navigation / flying mode in the 3D viewer #40893
Conversation
I've got two thoughts:
Looks like a big improvement either way! Thanks! |
This is great! Thanks! I can finally explore the Ankor Wat point cloud and walk through the building 😄 A couple of points based on some initial testing:
|
@NEDJIMAbelgacem , what does the UI for toggling/managing this nav mode look like? By the way, YAY! :) |
Left mouse button controls: |
I added this right mouse button movement to move the camera up/dowm (not in the z direction but the camera up axis) and left/righ |
WASD navigation: |
@nirvn For now I just added a combobox to choose a navigation mode |
Hmmm I don't know why is that happening, for me it works fine..
You mean to have the camera cursor being locked to the 3D view on one position like in video games ?
I kept the wheel to zooming in/out to make it a bit more uniform with the 2D view. I guess we can also have hotkeys for modifying the movement speed like Shift + '+' and Shift + '-'.
I changed to that now, in my head I know it's the camera up vector and that made it behave like flying in a true sense :)
That's already implemented with the mouse wheel.
Sounds good! |
Can you cherry-pick nyalldawson@cc73030 and nyalldawson@266c64b here please @NEDJIMAbelgacem ? |
nyalldawson@24d0aa5 is another one for consideration |
(also nyalldawson@eaafcc1 ) 😄 |
Nice! For UX I would suggest to have the navigation mode switch a button right in the toolbar of the 3D view, so it is not necessary to go to settings dialog to switch between the two. From code perspective, I think ideally the navigation mode should not be a property of the 3D map scene (in Qgs3DMapSettings) - and it would be better to have this property tied to 3D map canvas... |
The 3d map view should handle the key presses and not forward them to the map canvas / main app actions. The wasd keyboard region is most commonly remapped to useful actions and we don't want them firing randomly while flying in the 3d view!
There should be some visual feedback about movement speed changes. Setting too high a speed may easily result in a lost camera, since we have no visual feedback about camera position (camera x, y, z, pitch, yaw, roll would be great for both navigation modes!)
A drag-to-move option would be indeed handy since it is fully analog. If right-click is used for elevation change, then maybe with some modifier key? |
@NEDJIMAbelgacem for me your branch build fails with
|
@timlinux I doubt you need python to test this, disabling python should avoid sip issues. |
Yes doing so now, thanks |
f3cbff4
to
bac3baa
Compare
@NEDJIMAbelgacem can you also cherry-pick: |
@NEDJIMAbelgacem , @nyalldawson , thanks to both of you for working on this, it really elevates 3D support. |
Hi @wonder-sk
For that I added ctrl + ~ hotkey to switch between the two modes
I added the property in Qgs3DMapSettings so that the user can save the navigation mode he is using |
Instead of just reponding to key presses/releases (and auto repeat versions of these), instead track which keys are held down continuously and use a timer based approach to handle the actual resultant camera movement. This allows use of multiple keys when navigating, e.g. moving forward while strafing left/right/up/down.
7012ab9
to
c127146
Compare
UPDATE:
|
@NEDJIMAbelgacem Will the bindings be exposed and customizable? For people with different keyboard layout some keys may be more annoying to find/use. I think I use 4 or 5 layout variations and finding some keys like the tilde or the double quotes can be annoying. |
@roya0045 I suggest that customisation is deferred until we have support for customising non-main-window shortcuts through the shortcuts dialog (the same request also affects layouts). I'd rather not see an ad-hoc key customisation added just for these shortcuts alone. |
If customization is deferred, then we should avoid hard coding wasd and stick with the arrow keys that will work for most people. If wasd or the tilde is assigned in qgis to other actions then they do not work for 3d fly mode and the assigned action fires instead.
ctrl+~ is a pretty common shortcut for clipboard managers like ditto or copyq. I think we need something spacebar based here...
Again, this key may be occupied in qgis blocking its usage. Also, esc should also pop the mouse back or users will get trapped like novices trying to exit vim! Also, the mouse pointer visibility logic is lacking, you can also get trapped without a mouse pointer if you hit the navigation mode shortcut while on free look.
We need feedback for the movement speed change. If you scroll too much, which is easy to do accidentally if stuck on wrong mode, then trying to move will get you lost in no time!
This needs to be in a very visible spot on the toolbar. Like add a fly mode icon next to the hand icon, then make hand be terrain based movement.
Mouse pitch is inverted in all 3d view modes (move mouse up, camera looks down) but when free look is enabled this is changed?? This is very confusing, free look mode camera movement should be the same as moving the camera when pressing the mouse button!
|
I've got some plans in how to improve the capture of keystrokes here which should alleviate your concerns, but I'll submit them after this PR is merged during the feature freeze. For now, I'm going to go ahead and merge this prior to freeze with the understanding that if we can't get things resolved in time for final release then the mode can be disabled.
That won't be an issue if we ensure that the key is only caught when a 3d canvas is focused -- for those widgets theres no free text entry so clipboard handling isn't an issue
Agreed (and will try to address during freeze) -- but keep in mind that this mode was based off blender, and even that (with it's multi million $ / year budget) doesn't give this feedback. I don't see it as a blocker accordingly.
+1 - to be addressed during freeze
I disagree -- the general move to "natural" scrolling of widgets on desktop/mobile means that a click and drag implies the inverted motion, whereas when capturing the natural motion is the reverse. We should consider an inverted y axis setting for users though.
173298e fixes that
See above -- post merge i'm going to try reworking how these events are captured
Not if you grew up on FPS shooters 😆
Good feedback, thanks! |
The standard action for clipboard managers is to invoke their gui with this global shortcut, so they do pop up and steal focus. Is ctrl+~ a blender thing that we try to mimic here?
I've barely touched blender years ago, but I'd be shocked if in blender it is as easy to get completely lost as in qgis 3d view!
This is not about scrolling and widgets. Enter fly mode. Move the camera with lmb, pitch is inverted. Press ~ and move the camera, pitch is not inverted. Press ~ and move camera with lmb, pitch is inverted again. This is inconsistent.
Especially if you grew up on fps shooters! In shooters you always have mouse free look on. The perfect analogy is trying to avoid enemies when your wireless mouse suddenly ran out of batteries! You can only run forward and strafe, you can't hide, you're fragged! |
Ahh - I misunderstood your comment. " It would be better if left-right keys were turn left-right when the mouse pointer is visible " -- I thought you were referring to the a/d left right strafe keys here, not the cursor keys. In that case I agree with you. |
I'm glad you agree, but a is just the same as left key : Pre-doom shooters used arrow to turn and alt-arrows to strafe. They were built for playing with the keyboard. This is how I see the default fly mode. |
Description
This implements a new camera navigation mode with the WASD / arrow keys and the mouse to control the angles of the camera.
W / Up arrow : move forward
S / Down arrow : move back
A / Left arrow : move left
D / right arrow : move right
Q / Page up : move up
E / Page down : move down
And the clicking and moving the camera cursor changes the angle of the camera
Any feedback is welcome