ArcRotateCamera and right click

Hi,

I realise a dont introduce myself here, sorry about this.

I am technical artist getting more and more interest in the technical side even if my level in math is fairly low (alway looking by the window at school).

Since last month’s i am looking around all this current web tech’s, searching for my next fall in love.
i think i have found the major chemical ingredients.
To be honest i dont have any prior background or experience in this area, so, the challenge is here directly from start.
Also, for personal taste, learning purpose and conviction, i try to limit the dependencies as much as possible, so, no jquery, no vue, no react, no sass, etc … and all sort of big heavy over framework.

Here we are, i pick:
Typescript, because they say is modern, is typed and is like a upper class over javascript, why hesitate.
Electron, this is like the central point in my need about program mixing desktop and web universe.
And of course Babylon :slight_smile: which i am very happy about, obviously is needed to learn it … understand it etc…
For the 2d ui layer i will go for simple html5 and normal css.

All this to warn about, i will surely pull here very basic and naive questions.
Also, as Deltakosh ighlight it i probably have tendency to read to diagonaly the doc and the thread here :slight_smile:
So, thanks all of you guys in advance for your time and passion.

Ok, let start my new questions:

  1. i want to keep the ArcRotateCamera mouse control but without the right click.
    i already disable the keyboard and set the panning
  • camera.inputs.remove(camera.inputs.attached.keyboard);
  • camera.panningSensibility = 0;
    note:
    the middle mouse button rotate also the camera which is not a problem, even if it could be nice to disable too.
  1. How to rotate the sphere (rotation.y) with the right mouse button without influencing the camera ?

ArcRotateCamera and right click

thx.

1 Like

Welcome :slight_smile: and thanks for your this introduction!

  1. you can specify that you only want the left mouse button with camera.inputs.attached.pointers.buttons = [0]; => https://www.babylonjs-playground.com/ts.html#7RT4XP#1
  2. Now that the camera does not use the right button anymore, you can simply add an observer on `scene.onPointerObservable => https://www.babylonjs-playground.com/#1GLEJK#8
2 Likes

Hi,

i am always amazed how the answer is straight and simple … this make me a little shame, i should find the solution my self instead of taking your time …

Here what i have for who like me are at the begin of ther Babylon journey.

https://www.babylonjs-playground.com/ts.html#7RT4XP#2

Thx.

1 Like

Hi,
update about Typescript again.

https://www.babylonjs-playground.com/ts.html#7RT4XP#3

camera.inputs.attached.pointers.buttons = [0]; // do not work in my project
(camera.inputs.attached.pointers as ArcRotateCameraPointersInput).buttons = [0]; // obligate to write like this to make it work

i guess is the cost of the typed approach, anyway, more or less complex syntaxe, the main think is to get it working.

Thx.

yes this is the price to pay :slight_smile: