Changing the "output offset" of a 3D camera #15506
-
I am using a mix of orthographic and Pbr cameras to intermingle 3D models and 2D sprites. All backgrounds and various objects are rendered using an orthographic projection, and all 3D objects need the correct perspective that results from the 3D camera being located in a specific position. The 3D camera cannot be moved because the change in 3D perspective would break the coherence between the 2D and 3D objects. I now want to implement scrolling as the player moves across the field. For the 2D camera this is easy because I can just move the camera around via its Transform without changing the 2D objects. Is there another more straightforward way of achieving the same result? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For what it's worth, this is my current working solution.
It's basically a copy of PerspectiveProjection that will offset its output in the same way that changing a transform for an orthographic projection would. There is some aspect ratio magic going on to adjust for different FoVs of different maps, so that the offset property can have the same units as the othographic projection's transform. All 3D models require to be spawned with the NoFrustumCulling component because I couldn't be bothered to adjust get_frustum_corners accordingly. |
Beta Was this translation helpful? Give feedback.
-
This PR seems to implement the functionality that I need: |
Beta Was this translation helpful? Give feedback.
This PR seems to implement the functionality that I need:
#15537