Skip to content
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

Decoupling Cameras from the Player's Ship #4818

Open
Web-eWorks opened this issue Feb 27, 2020 · 2 comments
Open

Decoupling Cameras from the Player's Ship #4818

Web-eWorks opened this issue Feb 27, 2020 · 2 comments
Assignees
Labels

Comments

@Web-eWorks
Copy link
Member

@Web-eWorks Web-eWorks commented Feb 27, 2020

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:

  • An "editor camera" used to fly around the solar system and inspect / verify that procedural generation, AI behavior, and custom definitions are working as intended. This in particular will be extremely important in implementing terrain generation.
  • A "screenshot camera" used to take screenshots of the player's location and surroundings from arbitrary angles and positions, or to follow other ships or objects.

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:

  • Sidereal and External cameras need a "spring" behavior that prevents them from clipping inside world and ship geometry. This spring should offset the camera to push it out of geometry it would otherwise be clipping into, but should not limit the camera's zoom.
  • The External camera needs exponential zoom scaling; the further the distance from the orbit point, the more zoom should be applied given the same input.

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

  • Add Orbit camera, which updates the view orientation as the ship orbits around a body to keep the same orientation relative to the normal of the orbital position.
  • Add Chase camera, a fixed-yaw camera which applies an offset to the camera position based upon acceleration and changes in ship velocity.
  • Add Look At camera, a fixed camera which updates its orientation to track a specific target.

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.

@Web-eWorks Web-eWorks self-assigned this Feb 27, 2020
@Gliese852

This comment has been minimized.

Copy link
Contributor

@Gliese852 Gliese852 commented Feb 28, 2020

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

This comment has been minimized.

Copy link
Member

@impaktor impaktor commented Feb 28, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.