ArcRotateCamera to Orthographic

Hi Guys,

Currently I have this code for my ArcRotateCamera.

let ArcCamera = new ArcRotateCamera("camera", 0, 0, 10, Vector3.Zero(), this._scene);
ArcCamera.viewport = this.updateViewport(250, 250, 0, 0);
ArcCamera.radius = 3;

I’m trying to get it to display with an orthographic camera like this

ArcCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;

However, when I add this line of code, my scene disappears

Do i need to set something else?

Hi macleodjb,

It’s hard to be sure without seeing it in a Playground, but at a guess I’d imagine that the default orthographic render size is not what you’re expecting. For example, the following Playground sets the orthographic camera to have a hard-coded 4x4 render size, which makes the default scene look reasonable.

Orthographic ArcRotateCamera | Babylon.js Playground (babylonjs.com)

However, if you comment out the four lines setting the orthographic render size, you can see that the default render size is much larger, making the scene appear so small in the middle of the rendering that it barely looks like it exists at all. Can you try setting the orthographic render size in your seen and see if that fixes the issue?

2 Likes

That helped. Thank you. Got it working