# Programmatically zoom in/out the same way the mousewheel does it

**URL:** <https://forum.babylonjs.com/t/programmatically-zoom-in-out-the-same-way-the-mousewheel-does-it/15293>\
**Category:** Questions\
**Created:** [October 30, 2020, 11:37am UTC](https://forum.babylonjs.com/t/programmatically-zoom-in-out-the-same-way-the-mousewheel-does-it/15293 "2020-10-30T11:37:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gper2020](https://avatars.discourse-cdn.com/v4/letter/g/0ea827/32.png) [@gper2020](https://forum.babylonjs.com/u/gper2020)\
**Post date:** [October 30, 2020, 11:37am UTC](https://forum.babylonjs.com/t/programmatically-zoom-in-out-the-same-way-the-mousewheel-does-it/15293/1 "2020-10-30T11:37:19Z")

</div>

Hello, could you please help me with :

Using an ArcRotateCamera. By default, the user can mouse-wheel up/down to zoom in/out.  
But I also have in the UI separate zoom-in/out buttons, and I want them to zoom in/out in the same way (using that mouse-wheel smooth ease-out default animation) and amount that the mouse-wheel does it.

Until now I was using a hardcoded step to programmatically zoom in/out like :

camera.radius += ZOOM\_STEP;

but I noticed the default mousewheel zoom takes into account the scene’s overall size once I import a 3d model, so, a hardcoded setting that works for one 3d model, does not work well for another ( zooms faster or slower )

So, then, how can I programmatically zoom in/out the same way the mousewheel does?

Many thanks for your time

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 30, 2020, 5:08pm UTC](https://forum.babylonjs.com/t/programmatically-zoom-in-out-the-same-way-the-mousewheel-does-it/15293/2 "2020-10-30T17:08:35Z")

</div>

Actually here is the relevant code:

> <https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/Inputs/arcRotateCameraMouseWheelInput.ts#L88>

More specifically:

```auto
this.camera.inertialRadiusOffset

```

---

<div class="post-metadata">

**Author:** ![gper2020](https://avatars.discourse-cdn.com/v4/letter/g/0ea827/32.png) [@gper2020](https://forum.babylonjs.com/u/gper2020)\
**Post date:** [November 2, 2020, 6:57am UTC](https://forum.babylonjs.com/t/programmatically-zoom-in-out-the-same-way-the-mousewheel-does-it/15293/3 "2020-11-02T06:57:48Z")

</div>

Thank you very much Deltakosh for your time!
