pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.61k stars 371 forks source link

Decoupling Cameras from the Player's Ship #4818

Open Web-eWorks opened 4 years ago

Web-eWorks commented 4 years ago

As promised in #192, this issue tracks the work needed to detach the view controller from the Player and allow centering / orbiting arbitrary objects or indeed any point in space at all.

We have several use-cases for this but they ultimately boil down to two:

This naturally requires that the camera is able to "fly" on its own, with systems such as terrain generation and model rendering reacting appropriately to the presence of the camera and not the ship. As far as I am aware, most rendering-related systems use the camera's position by default, so I anticipate very little clean-up beyond decoupling such systems from vestigial dependencies on the player object.

As part of this work, we would like to improve handling of the existing cameras:

We would ideally like to add support for several additional camera controllers, being specializations of the general-purpose External camera:

This is not going to be a small undertaking, but the groundwork for it has been laid in #4536. This work will involve further decoupling ship and view controller, allowing PiGui to control the transition between a ShipViewController and a non-Ship ViewController, updating WorldView to properly handle the disconnect between a ship and a ViewController, and passing the responsibility for which object to orbit / center on to the ViewController instead of the individual CameraControllers.

Gliese852 commented 4 years ago

How do you look at making a camera relative to the global coordinate system when you are in space, as in eve online, for example, but switching on relative to the surface of the planet when you enter a rotating frame? (get close to surface)

impaktor commented 4 years ago

Someone somewhere once requested missile camera. Maybe that's implied in one of the above listed points.