Does the key combination WASD sound familiar to you? Did you ever look over the shoulder of your half-grown son, when he played his latest ego-shooter? Would you expect him to intuitively explore 3D data in Matlab much faster than you could ever do - with your good old 'zoom', 'pan', and 'rotate' buttons?
The next-generation engineer will use the 3D control scheme he has grown up with:
Mouse : Look up/down/left/right
'w' : Move forward
's' : Move backward
'a' : Move left
'd' : Move right
'Space' : Move up
'Ctrl' : Move down
'Shift' : Accelerate movement
'm' : Toggle up/down
'q' : Toggle mouse motion capture
'Esc' : Close figure
z = peaks;
Joerg Buchholz (2019). Doom 1.3 (https://www.mathworks.com/matlabcentral/fileexchange/9340-doom-1-3), MATLAB Central File Exchange. Retrieved .
Thank you for the reply Joerg! The "q" key was helpful.
Widening the FOV made a great improvement: camva(30).
I also went in the code and modified a few parameters to make it more smooth for me: angle_step=5e-5, step_size=0.05, acceleration=30.
Anael, I cannot currently check this under OSX. Did you try to press "q" twice before you move your mouse? What happens with very small mouse movements? Do you see the 3D object move?
Sounds great! But my axes disappear (or shift away?) as soon as i drag the mouse into the figure. It becomes an empty grey window...
P.S. using OSX with Windows keyboard config in matlab.
As a "next generation" engineer who has grown up with this scheme, I found this the most intuitive way to visualize 3D objects. Excellent work and a very creative idea. Thank you!
Another key to rotate the camera around its principal axis would be pretty awesome!
Did you fail to notice that this was a Pick of the Week? It would seem to make you look bad to give it such a poor rating, especially with no explanation why. John at least tried it out and had good critiques, which the author then incorporated into his code (to his credit).
Nice function. It would have been nice to include rotation as well.
There is a German paper called "Matlab Goes doom" (http://buchholz.hs-bremen.de/doom/doom.pdf) throwing a bit of light upon the mathematical background of doom...
Marc, thanks alot for the drawnow idea. I implemeted it in version 1.3 and uploaded it.
John, thank you for your helpful problem analysis. Could you please try out version 1.3 ("will be published within the next 2-3 business days.") and tell me if your problem persists?
If you cannot reach me via firstname.lastname@example.org (because your mail server is not RFC 2821 compliant) email@example.com should accept mail from your server.
One more question: Why does ALT-TAB not work for you to make the figure window active?
I had also problems with touching the mouse and the whole window froze, adding a
drawnow (or a disp(' ')) at the end of the mouse_moved function helped.
Joerg - I tried to respond to your e-mail, but it bounces
with the error: Client host rejected: Access denied.
I've also tried doom with many different variations of mouse sensitivity, but any touch of the mouse causes unrecoverable problems. And I can't make the figure window active without mousing onto it. Only if the mouse
cursor randomly happens to lie in the space of the figure
when created, then I click the mouse button with absolutely no mouse movement does doom work, and then just barely (way too slow). One touch of the mouse at any time and doom lives up to its name, even at the absolute minimum mouse sensitivity.
thank you very much for your improvement suggestion. I just implemented an initial "bring the figure into focus" into version 1.2 and uploaded it, so it "will be published within the next 2-3 business days."
Workaround until then: Whenever the mouse cursor is outside the figure you can press "q" twice to position it into the center of the figure. (And you can always use ALT-TAB to bring the figure into focus.)
I fail to see what is so impressive here. Its not at all easy to use, way too sensitive to the mouse. Since I need to mouse into the window to bring the figure into focus, as soon as I do, the axes disappear completely out of the figure window. Once this happens, the figure appears to be irretrievably lost.
it's on my to-do-list...
Wow! This makes analyzing 3D plots I've created (e.g., antenna patterns, refracting RF rays) much faster! Thanks!
Now for a request: is there a way you might be able to incorporate a rotation command about the camera location (possibly through another 'toggle' button which lets the mouse movement control the rotation)? You mentioned in your description 'zoom', 'pan' and 'rotate', and now I'm hoping you can include the 'rotate'part!
It doesn't work for MATLABR11 :(
a mouse capture toggle key is a helpful suggestion; I just implemented it and uploaded version 1.1.
But I do not have the slightest idea how to get the information from Matlab that the user pressed 'a' and 's' simultaneously.
Works great and fun. Easy to edit (to translate to french keyborad e.g.) and well documented. Would it be possible to be able to account for the pressing of 2 keys simultaneously ? E.g. strafe left + move backward. A key to switch mouse capture on/off would also be a plus.
Version 1.3: drawnow cures freezing on some graphic cards
Version 1.2: Initially, bring the current figure into focus
new source file
Version 1.1: Mouse motion capture can be toggled via key 'q'