# Camera Panning to Mouse wheel click

**URL:** <https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033>\
**Category:** Questions\
**Created:** [November 5, 2021, 7:08pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033 "2021-11-05T19:08:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![macleodjb](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/macleodjb/32/18459_2.png) [@macleodjb](https://forum.babylonjs.com/u/macleodjb)\
**Post date:** [November 5, 2021, 7:08pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/1 "2021-11-05T19:08:42Z")

</div>

Hi Guys,

How can I modify the panning behavior so that when you click the mouse wheel and hold it, it will do the panning. Not the right click.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![syntheticmagus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/syntheticmagus/32/395_2.png) [@syntheticmagus](https://forum.babylonjs.com/u/syntheticmagus)\
**Post date:** [November 5, 2021, 7:41pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/2 "2021-11-05T19:41:35Z")

</div>

Hi macleodjb,

From context and from your other question, I’m guessing that by “panning” you’re referring to rotating the `ArcRotateCamera`. Probably the best way to do this is by [customizing the camera inputs](https://doc.babylonjs.com/divingDeeper/cameras/customizingCameraInputs) for a default `ArcRotateCamera`. Hope this helps, and best of luck!

---

<div class="post-metadata">

**Author:** ![macleodjb](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/macleodjb/32/18459_2.png) [@macleodjb](https://forum.babylonjs.com/u/macleodjb)\
**Post date:** [November 5, 2021, 8:39pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/3 "2021-11-05T20:39:21Z")

</div>

No I am not referring to rotating. Panning so the scene only moves left to right. In any of the demos. You hold down the right mouse button and the camera will pan.

I just want the panning to happen when holding down the wheel instead

---

<div class="post-metadata">

**Author:** ![syntheticmagus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/syntheticmagus/32/395_2.png) [@syntheticmagus](https://forum.babylonjs.com/u/syntheticmagus)\
**Post date:** [November 5, 2021, 9:33pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/4 "2021-11-05T21:33:20Z")

</div>

Okay. I think the same answer applies, though: you’ll need to customize the camera inputs to respond to the mouse wheel click. The docs page I linked to should have information about one way to do that. You could also implement it yourself by translating the camera based on direction vectors retrieved from the camera’s world matrix, but I don’t think that would be easier than looking at what the cameras already do and replicating it for a different button.

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [November 5, 2021, 9:42pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/5 "2021-11-05T21:42:47Z")

</div>

Hello!

camera.\_panningMouseButton = 1

Be sure to set if after you attach the camera.

[https://playground.babylonjs.com/#XEAVZY](https://playground.babylonjs.com/#XEAVZY)

🖖

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [November 5, 2021, 9:45pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/6 "2021-11-05T21:45:12Z")

</div>

Hey @syntheticmagus!  
Sorry being a smartass. It’s actually a hidden public property not documented in API and I know about it just because I was implementing a HammerJS based input and I was looking at the camera source code the last days oftenly 🙂  
EDIT: so actually your answer is correct, I just pointed out how exactly we can do it 🙂

---

<div class="post-metadata">

**Author:** ![syntheticmagus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/syntheticmagus/32/395_2.png) [@syntheticmagus](https://forum.babylonjs.com/u/syntheticmagus)\
**Post date:** [November 5, 2021, 10:27pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/7 "2021-11-05T22:27:51Z")

</div>

@roland No worries, I didn’t think you were being a smartass at all! 😄 Thank you for knowing an easier approach and sharing it. I didn’t know about it before, so I got to learn something too!

---

<div class="post-metadata">

**Author:** ![macleodjb](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/macleodjb/32/18459_2.png) [@macleodjb](https://forum.babylonjs.com/u/macleodjb)\
**Post date:** [November 5, 2021, 11:07pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/8 "2021-11-05T23:07:46Z")

</div>

> [@syntheticmagus](#):
>
> h and sharing it. I didn’t know about it before, so I got to learn something too!

Thanks to you both. Very helpful

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 6, 2021, 2:34pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/9 "2021-11-06T14:34:49Z")

</div>

If you do not want to use the hidden property, you can also pass the value in the attachControl parameters

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/9/29fec3683a299a762ef88ef8c4b167f78ded2064.png)

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [November 6, 2021, 2:45pm UTC](https://forum.babylonjs.com/t/camera-panning-to-mouse-wheel-click/25033/10 "2021-11-06T14:45:34Z")

</div>

I was curious why is this quite important parameter hidden and as we can see it’s not and it is available at attach time. So it is a much cleaner way to set it that way. Thank you very much!
