FreeCAD icon indicating copy to clipboard operation
FreeCAD copied to clipboard

[Feature] Free Flight View (inspection Tool)

Open FreeCAD-Bug-Importer opened this issue 3 years ago • 21 comments

Issue imported from https://tracker.freecad.org/view.php?id=1095

  • Reporter: nikospap
  • Date submitted: 4/12/2013
  • FreeCAD version: trunk
  • Category: Feature
  • Status: new
  • Tags:

Original report text

Most of us have played First Person Shooters games.

When you are not taking part in the battle, you become a "spectator", and can move around in the 3D world, in some sort of free flight mode.

Depending on the game you might... a. flight/view through walls, as if you were a ghost b. have to go around objects (e.g. walls) as if you are a 3D being yourself.

Having the following scenarios in mind, I thing option b, would work better for FreeCad.

What's the purpose of it?

To inspect what you have created.

Let's say, you've created a set of interconnecting pipes, and want to see how the liquid would flow in them. With this tool you could travel in the pipes as if you were the liquid yourself.

Or you might want to create a house. With this tool you could flight around within the rooms, pretending to be a person walking in the house.


More... I would even go as far as suggesting the use of the standard, FPS, keyboard shortcuts, that many people are familiar with. Meaning, of course, WSAD.

Other bug information

  • Priority: normal
  • Severity: feature
  • Category: Feature
  • Updated: 2/6/2021

Discussion from Mantis ticket

Comment by yorik 2013-04-13 01:40

Honestly I see little point on trying to do that in FreeCAD, when it is simple to export your work to an application more suited for that kind of thing, like Blender.


Comment by nikospap 2013-04-13 11:52

So what if you want to change something in your work. Wouldn't that mean going back to Freecad, make the change, then export again, then open, again, with Blender, and then inspect again?

Depending on what you might want to create, how many times will you have to go back and forth between these programs?

That doesn't seem very practical.


Comment by nikospap 2014-07-28 06:42

Please, check the second video on the following link, where, in the John Deere factory, they have created a virtual, 3D copy of the production line. Amongst others, they use what I refer to as a "Free Flight View" to inspect the production process, and make the necessary changes, before they even start the production!

http://tinyurl.com/ky7cvkf


Comment by bejant 2014-12-11 14:37

This post is to provide links to similar FreeCAD developments.

In the John Deere video nikospap referenced it looks like the user is wearing an Oculus Rift (or some similar VR device) and dev jriegel is working on support for this: http://forum.freecadweb.org/viewtopic.php?f=9&t=7715

Additionally, FreeCAD forum member JMG has done something similar to a free flight view and has posted in the Users Showcase. It allows the user to define a path on which the camera travels, and then moves the camera along that path. http://forum.freecadweb.org/viewtopic.php?f=24&t=8437


Comment by DeepSOIC 2014-12-20 00:24

+1. I've seen the feature in Serious Editor and I used it... only! The standard CAD navigation is very usable for not-too-concave objects. But for exploring internal cavities that might be invisible from outside, free flight view is very handy. It's extremely hard to place the camera into a deep hole in an object with standard navigation.

FreeCAD-Bug-Importer avatar Feb 07 '22 15:02 FreeCAD-Bug-Importer

When I started using freecad, I really missed this feature! fps style navigation is the ONLY way I know how to intuitively and quickly navigate 3D spaces.
Adding the option should not be too hard, and especially people new to CAD would love it.

axaluss avatar Jun 07 '22 12:06 axaluss

You could also add options

  • to record a flight path (can be smoothened and finetuned afterwards)
  • configure different movement speeds (maybe a button to shift between walking and running)

axaluss avatar Jun 07 '22 12:06 axaluss

There is some different approaches to this feature floating around on the forum. I'll see if I can find them and notate this ticket.

luzpaz avatar Jun 07 '22 13:06 luzpaz

Do anyone have any way to get this feature? Navigating in a FPS kinda way.

Anprotaku avatar Apr 17 '23 01:04 Anprotaku

I also miss this feature, especially for large or complicated parts.

NXTler avatar Aug 26 '23 10:08 NXTler

Anyone want to take a stab at this feature ?

luzpaz avatar Sep 24 '23 03:09 luzpaz

@Rexbas as you've fixed most issues in the navigation styles, maybe that's something for you.

maxwxyz avatar Feb 25 '24 15:02 maxwxyz

Hmm, maybe, I will think about it.

Rexbas avatar Feb 25 '24 16:02 Rexbas

@kwahoo2 any interest into working on this feature ?

luzpaz avatar Oct 20 '24 14:10 luzpaz

@kwahoo2 any interest into working on this feature ?

This does seem to overlap with some work I've done in the XR workbench. It has 2 different navigation styles, demo below:

https://www.youtube.com/watch?v=Rugrs-qlXlw

  1. Arch-like movement: (like Quake with "noclip" enabled)
  • analog stick/trackpad of the primary (default left) controller moves viewer up/down and left/right,
  • analog stick/trackpad of the secondary (default right) controller rotates viewer around center of the HMD and moves forward/backward.
  1. Free movement: (like free 6 DOF game like, hmm Descent maybe?)
  • analog stick/trackpad of the primary (default left) controller moves viewer forward or backward along the controller axis,
  • analog stick/trackpad of the secondary (default right) controller rotates viewer around center of the controller.

Something similar could be done on the "flat screen" with gamepad input and keyboard as a fall-back. I have to look how the gamepad input is done in Qt6, since Qt Gamepad seems to be obsolete. SDL might be the only sane option here.

Also I am curious if there is any active open source/open hardware space mouse development and what kind of input can it provide. Maybe there can be a common interface for gamepads and FLOSS space mice.

kwahoo2 avatar Oct 20 '24 16:10 kwahoo2

Also I am curious if there is any active open source/open hardware space mouse development and what kind of input can it provide. Maybe there can be a common interface for gamepads and FLOSS space mice.

I know @mnesarco had something going with https://github.com/mnesarco/HyperController but it seems to be archived project as of this moment.

luzpaz avatar Oct 20 '24 16:10 luzpaz

forget HyperController, here is one better: https://github.com/ChromeBee/Hall-Effect-Sensor-CAD-Mouse-Spacemouse

mnesarco avatar Oct 20 '24 17:10 mnesarco

Python prototype for "Arch-like" movement: https://gist.github.com/kwahoo2/f627175344fedfb968ad37e453f8a6c1

https://github.com/user-attachments/assets/257b8853-5294-45f8-acb3-c3df05bb6f80

forget HyperController, here is one better: https://github.com/ChromeBee/Hall-Effect-Sensor-CAD-Mouse-Spacemouse

Interesting.


After thinking a bit more about it, I think mouse + keyboard like in a FPP game could be the best option. It would have to be a tool enabled by user, that captures mouse cursor and keyboard input until explicitly disabled (eg with Esc key).

My basic idea about bindings:

move keyboard/mouse gamepad
forward W left stick up
backward S left stick down
left A left stick left
right D left stick right
Yaw left mouse left right stick left
Yaw right mouse right right stick right
Pitch up mouse up right stick up
Pitch down mouse down right stick down
Roll CW E left stick right plus left trig
Roll CCW Q left stick left plus left trig
Scale up + right stick up plus right trig
Scale down - right stick down plus right trig

I think KB+M can be implemented without additional dependencies (while gamepad requires eg. SDL).

kwahoo2 avatar Oct 20 '24 21:10 kwahoo2

I (finally) started working on this. KB+M only, implementation similar to "View turntable": small window on top. This seems to be required if we like to catch WSAD keys, otherwise W is consumed by the workbench selector shortcut. Any ideas for the tool's icon?

kwahoo2 avatar Dec 28 '24 14:12 kwahoo2

@FreeCAD/design-working-group :point_up_2:

luzpaz avatar Dec 28 '24 15:12 luzpaz

Initial implementation (not merge ready) https://github.com/kwahoo2/FreeCAD/tree/free-flight W, S, A, D, Space, Ctrl - linear movement mouse or Q, E, arrow keys - angular movement The camera should be set as a perspective one.

https://github.com/user-attachments/assets/470e9361-c0d7-43e5-ad9c-3ce03433e1aa

Should work OK on Windows and Linux/X11, but Linux/Wayland does not allow to move/lock the cursor, so rotation with mouse with be limited by desktop borders. This is even worse with XWayland, as it thinks that setPos() moved the cursor, but it didn't. I haven't found a fix for this yet.

kwahoo2 avatar Dec 31 '24 21:12 kwahoo2

After some conversation with DWG, I decided to ditch the separate window, creating a small widget in the 3D view instead.

Image

after pressing Esc it extends and unveils preferences (key bindings, movement speed).

Image

Work in progress. Video

kwahoo2 avatar Feb 17 '25 20:02 kwahoo2

in addition to WASD for moving the camera around, there are some additional keys sometimes:

  • I J K L to pan the view around, in addition to the mouse look-around
  • Q and E or R and F, or U and O (like Q and E but around IJKL keys for right hand) to go up/down in Z axis

tigert avatar Feb 17 '25 21:02 tigert

Hello,

Since, I failed to deliver equal experience on all platforms, there is another attempt, basically point 4 described in this reply - external Python code that uses SDL3 library.

Demo video:

https://github.com/user-attachments/assets/0e5de7a4-1862-4396-84df-806a6fc988f4

Demo code for testing: https://gist.github.com/kwahoo2/5001f494d38ce3272dd926997b4bd05b

Please read comments at the beginning of the script. Adjust speed/sensivity to your preferences. And report if this does work (grabs/released keyboard and mouse without issues) or not in your configuration.

Since SDL is a gaming oriented library it supports grabbing mouse much better than Qt. Also potentially it could support other input devices, like gamepads.

A major disadvantage is that it introduces an additional dependency. For that reason, I would like to distribute it as external addon.

As for problems described in the merge topic linked earlier:

  • some keys not working - they should work now, as this is independent window catching all events
  • cursor not locking on some platforms - should be ok now, thanks to SDL3
  • velocity too low for big models, to high for small ones - velocity is now adjusted to cube root of a scene bounding box
  • camera is moving in all views - will not happen anymore, since the new window uses its own camera and SoRenderManager

kwahoo2 avatar Aug 15 '25 19:08 kwahoo2

They should add this as a navigation option. Where when holding down right click you can rotate camera and WASD to move. its so much simpler orbit makes me want to die.

TrevorBlythe avatar Dec 07 '25 22:12 TrevorBlythe

A major disadvantage is that it introduces an additional dependency. For that reason, I would like to distribute it as external addon.

@kwahoo2 I think this could be discussed with maintainers, perhaps they find that the benefits of having this feature trumps the addition of the PySDL3 dependency. I could imagine that could be a great feature to have for the BIM workbench.

Would you be up for submitting your demo code as a draft PR for discussion?

furgo16 avatar Dec 10 '25 08:12 furgo16

@furgo16

I don't want blur the discussion in more places, there is this topic, and 1 (failed) PR created.

For now I need to know if the demo code works as intended in every OS/WM configuration:

  • does the mouse lock work?
  • do all keys work as intended?

There is the matrix that should be filled:

OS Windows Linux X11 Linux Wayland macOS other OS
Mouse Lock OK OK OK ? ?
Keys OK OK OK ? ?

After that I can work on a proper SDL (pySDL) integration. Then I'll create a PR.

kwahoo2 avatar Dec 14 '25 11:12 kwahoo2