# How to disable left-click camera rotation?

**URL:** <https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939>\
**Category:** Questions\
**Created:** [March 11, 2023, 3:52am UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939 "2023-03-11T03:52:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Corysia](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corysia/32/50154_2.png) [@Corysia](https://forum.babylonjs.com/u/Corysia)\
**Post date:** [March 11, 2023, 3:52am UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/1 "2023-03-11T03:52:42Z")

</div>

I’m working on a small maze game to learn BabylonJS ([GitHub - Corysia/squeakers: A simple maze game. Can you find the cheese?](http://github.com/Corysia/squeakers)) and I’d like to disable the ability to rotate the camera on mouse left-click. I’ve the functionality I want with a right-mouse click and intend to use left-mouse for selection. Is there an easy way to disable that in the FreeCamera, or do I need to wipe all inputs and add back in the ones I want?

---

<div class="post-metadata">

**Author:** ![samuelgirardin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/samuelgirardin/32/87_2.png) [@samuelgirardin](https://forum.babylonjs.com/u/samuelgirardin)\
**Post date:** [March 11, 2023, 10:10am UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/2 "2023-03-11T10:10:46Z")

</div>

Hello, you can try this :  
_camera.inputs.attached.pointers.buttons = [2];_

> **[Babylon.js Playground](https://playground.babylonjs.com/#96J37Q%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

And maybe have a look there : [Deactive some Camera inputs](https://forum.babylonjs.com/t/deactive-some-camera-inputs/33044)

---

<div class="post-metadata">

**Author:** ![Corysia](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corysia/32/50154_2.png) [@Corysia](https://forum.babylonjs.com/u/Corysia)\
**Post date:** [March 11, 2023, 5:02pm UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/3 "2023-03-11T17:02:59Z")

</div>

That does seem to work great in the playground, but not in my app. I’m getting `undefined` for pointers.

```auto
    constructor(location = new Vector3(0, 0, 0), scene = SceneManager.Instance.Scene, canvas = SceneManager.Instance.Canvas, ) {
        console.debug("FirstPersonController");
        this.scene = scene;
        this.camera = new FreeCamera("FirstPersonController", location, scene);
        let manager = this.camera.inputs.attached;
        console.log("Manager: ", manager);
        console.log("pointers: ", manager.pointers);
        // this.camera.inputs.attached.pointers.buttons = [2];

```

Looking at the console, I only see `keyboard` and `mouse` as attached inputs.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/f/1f9d3c1d0e10534215e776114669cbc063bd8062.png)

If I enable `this.camera.inputs.attached.pointers.buttons = [2];`, then I get the following error:

```auto
ERROR in /Users/corysia/Dev/BabylonJS/squeakers/src/FirstPersonController.ts
./src/FirstPersonController.ts 20:45-52
[tsl] ERROR in /Users/corysia/Dev/BabylonJS/squeakers/src/FirstPersonController.ts(20,46)
      TS2339: Property 'buttons' does not exist on type 'ICameraInput<FreeCamera>'.
ts-loader-default_e3b0c44298fc1c14
 @ ./src/main.ts 16:0-64 46:46-67

```

I thought perhaps it was because I was using a FreeCamera, but I run in to the same problems with an ArcRotateCamera.

---

<div class="post-metadata">

**Author:** ![Corysia](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corysia/32/50154_2.png) [@Corysia](https://forum.babylonjs.com/u/Corysia)\
**Post date:** [March 11, 2023, 5:22pm UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/4 "2023-03-11T17:22:57Z")

</div>

Experimenting in the Playground, I see the same problem if I convert to TypeScript, which is what I’m using.

> **[Babylon.js Playground](https://playground.babylonjs.com/#96J37Q%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Corysia](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corysia/32/50154_2.png) [@Corysia](https://forum.babylonjs.com/u/Corysia)\
**Post date:** [March 11, 2023, 7:23pm UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/5 "2023-03-11T19:23:54Z")

</div>

With the hints @samuelgirardin provided, I was able to find a TypeScript solution. While there’s a `mouse` apparently available down in there somewhere, it’s not as accessible in TypeScript. So, adding it in, then disabling in a similar way works great.

> **[Babylon.js Playground](https://playground.babylonjs.com/#96J37Q%233)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Convergence](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/convergence/32/6789_2.png) [@Convergence](https://forum.babylonjs.com/u/Convergence)\
**Post date:** [March 11, 2023, 9:01pm UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/6 "2023-03-11T21:01:27Z")

</div>

This similar thread might offer some more insight

> [@Change mouse actions](https://forum.babylonjs.com/t/change-mouse-actions/9753/10):
>
> My goal was to achieve the following behavior: Right click is rotation Left click is panning On my BABYLON.ArcRotateCamera. I was able to do this by adding the following line after the camera was attached to the HTML canvas: camera.\_panningMouseButton = 0;

---

<div class="post-metadata">

**Author:** ![Corysia](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corysia/32/50154_2.png) [@Corysia](https://forum.babylonjs.com/u/Corysia)\
**Post date:** [March 12, 2023, 4:51am UTC](https://forum.babylonjs.com/t/how-to-disable-left-click-camera-rotation/38939/7 "2023-03-12T04:51:33Z")

</div>

It did, thanks. It helped me understand how to handle an ArcRotateCamera, too. Because the API is different.
