Centering a plane to the viewport only by adjusting its x position, or the cameras target

I have a plane that I’m displaying information on. Using an ArcRoateCamera Id like it to be centred horizontally to the 2d viewport. With both edges always being centered to the left and right.

Obviously, the camera’s perspective means the edges wouldn’t usually be the same distance from the 2d horizontal canvas edges.

Here’s an example, the green and red spheres should be an equal distance from the vertical lines

And here’s a rough example adjusted manually to be centered
_scene_opt

I assume I could either adjust the planes xPosition, or the cameras target zPosition. Im looking for the optimum way to calculate for either approach.

Id also like to avoid adjusting the FOV, as I need that to be consistant in the scene.

Thx

Do you want the camera to fly into the grid?
RenderTargetTexture Water Sphere | Babylon.js Playground (babylonjs.com)
Or do you want an orthogonal camera?
RenderTargetTexture Water Sphere | Babylon.js Playground (babylonjs.com)

1 Like

Sorry, should have mentioned ill be preventing the camera from going past 180, so ill never reach the plane

Hello just checking in @ThaFresh but do you still need any help?