bluenote10
bluenote10

Reputation: 26550

How to implement an off-center camera in Godot?

I'm trying to figure out how one can "offset" a camera within its viewport (the root viewport in this case) to create an off-center camera. To illustrate, using a standard Camera (3D) results in a vanishing point of the parallel lines in the center of the screen:

enter image description here

What I'm trying to achieve is to move the vanishing point a bit to the right, to the center of non-UI area.

I was expecting that Camera.h_offset has this effect. However, it looks like it is only another way of applying a translation to the camera (i.e., equivalent to translating the camera itself to the left/right):

enter image description here

Am I missing a trick?

Upvotes: 3

Views: 674

Answers (1)

Theraot
Theraot

Reputation: 40170

I don't think you can do that with a perspective projection. Well, aside from using a ViewportContainer which you move to the side. You would use a frustum projection instead, and then use frustum_offset to skew it. You probably want to se the size very small.

Upvotes: 2

Related Questions