Rotate object not camera

Is it possible to rotate the object / mesh not the camera?

https://playground.babylonjs.com/#GHYUA1#3

Your PG does not work:

To rotate a mesh, use mesh.rotation.x = val_in_radian (or .y / .z).

Just to clarify my question, I want to rotate a mesh with the mouse. Not rotate the scene.

Use a pointer event to react to mouse moves and in the function just update the mesh.rotation property (you should find the info you need in pointerInfo.event).

1 Like

I am having problems finding documentation on pointerInfo.event, am I going at it in the wrong way maby?

I found this but it looks super advanced for what I am looking for.
https://www.babylonjs-playground.com/#11ERZN#2

I think pointerInfo.event is the regular HTML event, so you should easily find documentation about it (for eg: Element: mousemove event - Web APIs | MDN).

Note that scene.pointerX and scene.pointerY always give you the current position of the mouse.

Thanks for the help, but I can´t get it right.

What about this:

PG: https://www.babylonjs-playground.com/#2CU0P1#8

1 Like