# How to dynamically adjust the camera in three js

**URL:** <https://discourse.threejs.org/t/how-to-dynamically-adjust-the-camera-in-three-js/15593>\
**Category:** Questions\
**Tags:** camera\
**Created:** [May 27, 2020, 6:33am UTC](https://discourse.threejs.org/t/how-to-dynamically-adjust-the-camera-in-three-js/15593 "2020-05-27T06:33:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [May 27, 2020, 7:49am UTC](https://discourse.threejs.org/t/how-to-dynamically-adjust-the-camera-in-three-js/15593/2 "2020-05-27T07:49:24Z")

</div>

One way to solve this issue is by changing camera parameters based on the bounding box of your mesh. This approach is used by viewer application like the `three.js` based [gltf-viewer](https://gltf-viewer.donmccurdy.com/). Check out the following code listing for more information:

> <https://github.com/donmccurdy/three-gltf-viewer/blob/a5fd64686f55a8cb3effd8914b2cbcca6b6cbae1/src/viewer.js#L266-L293>

The code also centers the object which is probably not required in your scene.

---

_[View the full topic](https://discourse.threejs.org/t/how-to-dynamically-adjust-the-camera-in-three-js/15593)._
