How to control the rotation of the camera only by move the mouse?

#1

Hi fellow Babylon.js

I mean something like that:

function onMouseMove( e ) {
		camera.rotation.y = e.clientY;
		}

How to make everything work like in the example below, but without using the left mouse button, just by moving the mouse.

https://www.babylonjs-playground.com/#LR4YHT#0

To work like in VR, only without changing the view on glasses.

Then I would like to modify the object in a similar way, eg change the color with the mouse movement.

I hope you can help me. Thanks in advance!

Thank you Deltakosh for this hint.

And how to make the whole thing behave like mouseover.
The exit from this state could be to move the cursor out of the canvas area or the left mouse button again.

I’m interested in something like that. Deactivation when the kurosor leaves the area.
https://www.babylonjs-playground.com/#1JYENJ

I found something.
It’s about to look like that.
Now only change the deactivation of ESC to something else, eg any mouse button.
https://www.babylonjs-playground.com/#52LP1L#34

0 Likes

#2

Hey and welcome!!

what about using pointerlock?
https://www.babylonjs-playground.com/#PLW9V9#19

1 Like