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

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.

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.

I found something.
It’s about to look like that.
Now only change the deactivation of ESC to something else, eg any mouse button.

Hey and welcome!!

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

4 Likes