3rd person camera with ArcRotateCamera

Hi guys,

So I was playing around with 3rd person camera I need. And tbh ArcRotateCamera is perfect for that. Except the default RMB have camera panning and what I needed is orbit (same as LMB and MMB).

And rather quickly I managed to do what I want. https://playground.babylonjs.com/#6JYB38#2

But now I completely don’t understand why the line mouseInputs.onButtonDown = ev => {} removed panning and replaced it with orbit behaviour. So now all the mouse buttons orbit the camera.

But this line doesn’t do anything :rofl:. So why is that?

ping @PolygonalSun

So the reason why overriding onButtonDown disabled panning is because, inside of ArcRotateCameraPointersInput, we use that to check if the button pressed is the assigned pan button and pan accordingly and overriding it removes this logic. If you want to remove panning with the RMB, you could just modify attachControl control call to look something like this: camera.attachControl(true, true, 3); The 3 at the end will reassign the panning mouse button to be something other than Left (0), Middle (1), or Right (2) Click. Technically, the 3 button is the Browser Back Button I think. You could also set it to -1 so that no buttons pan.


Thanks for the explanaition. And I think I was also a bit confused, as this line actually does something. It’s registering an empty event!