Change mous actions

hello ,
i want to change mouse actions like that :

right mouse button: rotation of the scene

middle mouse button: scroll in the scene

left mouse button: selection of an object

thanks for help :slight_smile:

Hi viche! Please see this post…

It shows how to assign WHICH mouse-actions… to WHICH camera-actions.

There is a playground demo provided there…

In that demo, right and left mouse buttons (assigned to cam) are reversed, and middle wheel remains unchanged. Keep in mind that the CAMERA is being changed, not really the mouse.

I’m not an expert, but perhaps this will work for you. Be well.


the middle mouse button still not working with the scroll on the scene :confused: also the i want to desactiv the left mouse action (just available for the selection). :slight_smile:

Ahh, ok, sorry. I’ll study/work on this.

(I was mistaking scroll with “zoom”)… I didn’t read very well. :slight_smile:

In above playground, center and right button working properly, yes?

But… we still need to “detach” left button from camera, somehow?

I think that is what you wish. I will study it more, and we shall ask for more helpers.


thanks my freind for ur help and yes it’s works just like u say i still need to detach the left button from camera :slight_smile:

1 Like

Nod. Perhaps this is not so easy.

Looking around in there… phew… over my head. All (most?) cameras have a “input” module like this. (camera.inputs), and often…cams have multiple inputs-types allowed.

You can see… in THIS folder… Babylon.js/src/Cameras/Inputs at master · BabylonJS/Babylon.js · GitHub … that there are 5 possible .inputs for the arcCam… gamepad, keyboard, mousewheel, pointers (mousebuttons), and VR DeviceOrient.

AND… BaseCameraPointersInput.ts … the top one.

That BASE camera inputs file… might be where we need to make “hacks”… essentially fooling the camera into thinking that there are only TWO buttons on the mouse. I’m not sure if I know how to hack that well. Can you?

Might need super-hackers or… maybe… this cannot be done and you’ll need a different game plan. hmm. Still studying.

In the #16 playground … I was hoping a -1 in line 24… would disable left button… because of what I saw in BaseInputs line 68. (the -1 thing). But the -1 thing… is just a tester for “not found in the array” and doesn’t do what I hoped for. :slight_smile:

console.log(camera.inputs.attached); reports 3 input modules… but baseCameraPointersInput may also be there… just not shown to us.

1 Like

thanks for your effort and specialy for your explanation :slight_smile:

1 Like

hmm, no new ideas for disabling left button for arcCam, today, huh? Darn. I was sort of hoping that someone had a fresh idea.

Ok, let’s re-brief… in hopes for a miracle. - we have set “strafe” (panning?) on center mouse button, and orbit on right mouse button… as wanted.

We now want left mouse button to do NOTHING for the camera, yet still remain active for future mesh-picking.

Line 24… camera.buttons array - I tried -1, null, and undefined in that zeroth array slot (guessing)… no joy. Left mouse button-drag… still orbits the camera.

Does anyone have any ideas… to disable LMB-drag? (thx). (Wingy crosses his fingers, and crosses Viche’s [mouse-] fingers, too) :slight_smile:

1 Like