Glb file moving with mouse hover?

Track mouse over the entire screen, not just the canvas. Cap moves smoothly when you move the mouse (follows a bit).

I don’t undertsand your post. Are you asking how you would do this?

You can get the mouse x and y position in javascript using the screenX and screenY mouse event properties: MouseEvent.screenX - Web APIs | MDN

If this is some sort of bug, then you will need to post more information.

1 Like

Sorry this is a question of how to make this happen. But how can you make screenX and screenY mouse event on a glb file move very smoothly. So that he follows your mouse a little bit but stays in his position it object. Sorry my english is not that good.

I am fairly new to Babylon so maybe someone else can help more, but my initial thoughts:

It might be that you want to move the camera within your scene, rather than moving the mesh itself…It would be more performant I think. The arc rotate camera would probably be the best for this.

In order to do that, you need some way to remap the (x,y) values from the mouse move event to the camera position/rotation.

In order for the canvas to continue to receive the mouse position I believe you will need to use the pointerlock api: Pointer Lock API - Web APIs | MDN

That page has an example of sending the mouse position to a canvas element: Pointer lock demo

Does that make sense?

1 Like

BTW I just came across this and perhaps using this would be handy for animating things on scroll

1 Like