# Zoom main camera to fit bounds / game-objects?

**URL:** <https://phaser.discourse.group/t/zoom-main-camera-to-fit-bounds-game-objects/9078>\
**Category:** Phaser 3\
**Created:** [March 9, 2021, 11:37am UTC](https://phaser.discourse.group/t/zoom-main-camera-to-fit-bounds-game-objects/9078 "2021-03-09T11:37:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixelburp](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/pixelburp/32/1937_2.png) [@pixelburp](https://phaser.discourse.group/u/pixelburp)\
**Post date:** [March 9, 2021, 11:37am UTC](https://phaser.discourse.group/t/zoom-main-camera-to-fit-bounds-game-objects/9078/1 "2021-03-09T11:37:09Z")

</div>

Say I want to zoom the camera to fit a `Geom.Rectangle` bounds, or a pair of game objects - is that even possible? Camera zooms appear to be purely numeric values, whereas I was hoping to be able to zoom the camera so that it always fitted GameObject A & GameObject B within the viewport (so I could create a `Rectangle` bounds from this easily enough if that was the way to do it…

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 9, 2021, 4:08pm UTC](https://phaser.discourse.group/t/zoom-main-camera-to-fit-bounds-game-objects/9078/2 "2021-03-09T16:08:51Z")

</div>

https://codepen.io/samme/embed/preview/BaoXxdx?height=300&slug-hash=BaoXxdx&default-tabs=js,result&host=https://codepen.io

---

<div class="post-metadata">

**Author:** ![pixelburp](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/pixelburp/32/1937_2.png) [@pixelburp](https://phaser.discourse.group/u/pixelburp)\
**Post date:** [March 9, 2021, 4:30pm UTC](https://phaser.discourse.group/t/zoom-main-camera-to-fit-bounds-game-objects/9078/3 "2021-03-09T16:30:20Z")

</div>

Nice, Samme to the rescue again. Thanks for that, that’s perfect 👍

---

<div class="post-metadata">

**Author:** ![jamaalsawyerd](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jamaalsawyerd/32/1621_2.png) [@jamaalsawyerd](https://phaser.discourse.group/u/jamaalsawyerd)\
**Post date:** [December 2, 2021, 4:21am UTC](https://phaser.discourse.group/t/zoom-main-camera-to-fit-bounds-game-objects/9078/4 "2021-12-02T04:21:28Z")

</div>

Thank you, this indirectly helped me as well.
