# Possible bug with camera inputs?

**URL:** https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944
**Category:** Questions
**Created:** [March 3, 2020, 9:19am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944 "2020-03-03T09:19:33Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 3, 2020, 9:19am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/1 "2020-03-03T09:19:33Z")

</div>

The following code works fine in my project:

```auto
scene.activeCamera.inputs.attached.pointers.buttons = [0];
// 0 for left mouse button - 1 for scroll wheel press - 2 for right click

```

However setting the button ID to 2, which should let it be controlled by right-clicking - Does nothing, 0 and 1 work as intended.

I’m unfortunately unable to create a playground on this particular problem as it doesn’t work at all there:  
[![](https://i.gyazo.com/533629e1156e81bb1f9b29739f4e7921.png) ](https://i.gyazo.com/533629e1156e81bb1f9b29739f4e7921.png)

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [March 3, 2020, 9:30am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/2 "2020-03-03T09:30:36Z")

</div>

I think this is a misunderstanding as to what the buttons array does.

The button array define which buttons are read and used as input, but not their action. It is an arry of accepted buttons. So if you want the left click to stop working and doing what it is intended to do, you remove 0 from the array. if you don’t want tight click to ever work, remove the 2 from the array. but it does not mean that when removing 0, 2 will take its place.

would be wonderful to have a playground. the reason the playground complains in the generic way the inputs were implemented. try either casting to the right class (the PointerInput class of the camer you are using) or cast to any, just for the sake of making it work. This will be easier for us 🙂

---

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 3, 2020, 9:35am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/3 "2020-03-03T09:35:33Z")

</div>

Ahh, I had figured I was using it correctly as passing in [1] made it so that the camera only reacted to click the scroll wheel. I’ll try to get a PG working.

---

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 3, 2020, 9:56am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/4 "2020-03-03T09:56:09Z")

</div>

@RaananW

[https://www.babylonjs-playground.com/#HDQ3H4#2](https://www.babylonjs-playground.com/#HDQ3H4#2)

if you comment/uncomment the different lines you’ll see what I mean.  
I’m unsure if I’m doing this wrong ☹

Either way, my main goal here is to rotate the camera when I right click & drag rather than the left click default 😛 Any help towards that goal would be greatly appreciated \<3

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [March 3, 2020, 10:09am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/5 "2020-03-03T10:09:30Z")

</div>

Thanks 🙂

How is that - [https://www.babylonjs-playground.com/#HDQ3H4#3](https://www.babylonjs-playground.com/#HDQ3H4#3)

What actually being done here is moving the panning functionality to the left click, keeping the right click free to just run regular pointer events. See the attach function

---

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 3, 2020, 10:14am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/6 "2020-03-03T10:14:51Z")

</div>

PERFECT. I hate how simple the solution usually is. lol. Thanks a ton!

---

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 3, 2020, 7:57pm UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/7 "2020-03-03T19:57:45Z")

</div>

@RaananW just out of curiosity, how does this work?  
attachControl() seems to only take:

```auto
camera.attachControl(canvas, true);

```

According to the docs [Here](https://doc.babylonjs.com/babylon101/cameras)

---

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 3, 2020, 9:41pm UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/8 "2020-03-03T21:41:31Z")

</div>

I guess my question here is what do the second true, and 0 do in  
camera.attachControl(canvas, true, true, 0)  
In regards to switching the mouse functions

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [March 4, 2020, 5:52am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/9 "2020-03-04T05:52:01Z")

</div>

That’s because I checked the specific camera’s API (in your case the arc rotate). some cameras have extra variables. This trick will not work on a different camera, but other things will 😊

---

<div class="post-metadata">

### Author: ![Ateria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ateria/32/1351_2.png) [@Ateria](https://forum.babylonjs.com/u/Ateria)
#### Post date: [March 4, 2020, 6:03am UTC](https://forum.babylonjs.com/t/possible-bug-with-camera-inputs/8944/10 "2020-03-04T06:03:28Z")

</div>

Found it thank you! I appreciate your help here 💖💖
