Camera behaviour while resizing window

Hello,

I’ve noticed these two behaviours while I resize the window:

  • Reducing the height camera seems to zoom out, larger area visible.
  • Reducing the width camera visible area is cropped, less area visible.

Can this behaviour be switched/changed?

Thanks,

If it’s the behaviour I think you are talking about, the Model Viewer Starter Kit checks the height/width and changes the camera.horizontalFov accordingly.

OrbitCamera.prototype._checkAspectRatio = function () {
    var height = this.app.graphicsDevice.height;
    var width = this.app.graphicsDevice.width;

    // Match the axis of FOV to match the aspect ratio of the canvas so
    // the focused entities is always in frame
    this.entity.camera.horizontalFov = height > width;
};
1 Like

Thanks @yaustar, yes this helps us take advantage of this behaviour.