osp-magnum icon indicating copy to clipboard operation
osp-magnum copied to clipboard

Arcball Camera

Open Capital-Asterisk opened this issue 4 years ago • 1 comments

Relevant files:

  • https://github.com/TheOpenSpaceProgram/osp-magnum/blob/master/src/adera/drawing/CameraController.cpp
  • https://github.com/TheOpenSpaceProgram/osp-magnum/blob/master/src/adera/drawing/CameraController.h

Rotating the camera around in-flight feels a bit weird, as the current implementation directly adds mouse delta x/y to camera yaw/pitch.

The way to rotate around in 3D space without an "up" appears to be the "Arcball." There exists an example for Magnum, as well as many other useful resources on how to implement it, such as this OpenGL tutorial. Ideally this is a simple self-contained task, but may also call upon other improvements elsewhere in the project wherever lacking.

Also a good idea to rename the "ui_rmb" control to something like "camera_orbit" or something similar, as controls are intended to be rebound to different buttons.

Capital-Asterisk avatar Jul 10 '21 03:07 Capital-Asterisk

~~Update~~

~~CameraController was de-spaghettified in #161; far simpler than the previous. An 'arcball mode' can be added to it some time later.~~

~~Associated files:~~

~~https://github.com/TheOpenSpaceProgram/osp-magnum/blob/40d051ff969a9f4e5feb9cd2c7b61f0e514b2591/src/test_application/activescenes/CameraController.h~~

~~https://github.com/TheOpenSpaceProgram/osp-magnum/blob/40d051ff969a9f4e5feb9cd2c7b61f0e514b2591/src/test_application/activescenes/CameraController.cpp~~

Capital-Asterisk avatar Dec 18 '21 11:12 Capital-Asterisk