Is there a way to fix the camera to one target/ disable panning in React app

I have multiple camera facing different views. I have set my arcRotateCamera to its target. Is there anyway I can disable the screen panning in the arcRotateCamera component in ReactApp.

@brianzinn may know about this one.

1 Like

If you are not using react-babylonjs then the answers would be non-specific to React and then it’s easier to get help from the community with more generic questions!

There is a lot of power to handle pointer events yourself. You can remove the existing inputs entirely like this:

That will remove all input and is likely not what you are after!

Here is the default input handler, so you could modify it an register/replace the default behavior:

I would read this article - it’s got lots of useful tips for customizing the input:

Let us know how that goes. Cheers.


Hi gang. If I may butt-in with simpleton-talk…

IF… by the term “panning”… @simran_jain meant right-mouse-button dragging (slewing cam target)… then here are some easy possibilities:

camera.inputs.attached.pointers.buttons = [0,1]; // disables right button
(thx BrianZinn… good to see you)


camera.panningDistanceLimit = .0001; // Makes RMB-drag do almost NOTHING to the target position.


camera.panningSensibility = 0; Essentially disables RMB dragging.

But IF @simran_jain REALLY meant to say “orbit” instead of “panning”… then…

camera.inputs.attached.pointers.buttons = [2]; // disables LEFT and CENTER button… no orbiting possible. (somewhat similar to detaching camera from canvas)

Just a few “dirty hacks”. :slight_smile: These “hacks” might conflict-with touch-screen gestures such as pinching and swiping. No promises.