1

I have a small issue about a custom cursor made in react three fiber. To track the mouse movement on the viewport and update the position of an element with it is quite easy but it get's trickier once you add camera movements in the equation.

I made a small codepen to showcase the problem, basically my custom cursor would only work if my camera was right in front of the scene, for instance if the position was [0,0,5] which is not the case in my project.

https://codesandbox.io/s/simple-serotoninene-forked-shwiw?file=/src/ThreeElements/CanvasContainer.js

To add more complexity i also have camera animation on mouse movement on my real pro, which gets the cursor even wronger.

Anyone has a trick to resolve my problem ?

Thanks !

0 Answers0