Rotate Mesh according mouse position, even outside a mesh

Hey everyone! First here and my first time working with Babylonjs. I’m trying to rotate a Mesh using onPointerMove() and mesh.lookAt(). It’s working correctly, but only when the mouse is pointing to a mesh. Is there a way to capture the pointer position to rotate the mesh according to its position, even if the pointer is not looking at a mesh?

Here, the cube will only rotate when the mouse is looking at the ground:

Is that too hacky?

Otherwise, canvas.mouseMove and convert screen x,y to world x,y,z?


That’s really clever. I’ll give it a try, thanks!