I have a grid and and I added click event to open a modal when the grid is clicked. I also enabled OrbitControl on the renderer.
My modal div is set to absolute and appears on top of the canvas.
Now if I move the camera angle and then click on the grid to open the modal, the camera reset’s itself to the original position.
What are my options here and how can I avoid the camera resetting itself to the original position?
It’s not really possible to help without seeing the code.
By itself, Camera (and Three overall) shouldn’t really reset - it’s quite likely you are accidentally doing it yourself. See if you aren’t overriding the camera, its position, or the entire Three canvas at some point.
@mjurczyk thank you for your reply,
here is a small example : Glitch :･ﾟ✧
to open the modal either click on the planet or the box. Notice if you move the camera angle before opening the modal, it reset’s the camera even on that small example.
Edit: if I remove the
:pointer parameters, the camera doesn’t reset. However I need the pointer parameter on my project.
Can’t believe im the only one having this issue ?
It seems like the issue is not in three itself, but rather GitHub - troisjs/trois: ✨ ThreeJS + VueJS 3 + ViteJS ⚡.
May be a bit faster / easier to open an issue on github, or contact the author of the library ?
Please to your issue, I think I have same issue from last couple of days and till date i can’t able to understand what actual issue occurred??
I had the same issue, the camera was reseting to the original position, what I did was putting my html code outside the Scene and Render labels.