When I come back to babylon engine again and I want to make measurement (so I create again new scene and new event listener)
the measurements are being taken like this:
I didn’t moved mouse cursor here too
compared to first picture it’s like a little off the top of the cursor and it shouldn’t be like this. I wanted center of sphere when being created to be on the top of cursor.
I am not sure if it’s javascript or babylon problem. Do you have some idea how to fix this?
*Edit Actually it’s happening even when I don’t remove scene and eventlistener. Just switching routes and coming back to babylon engine making taking measurements acts oddly.
maybe the canvas is removed from the DOM by the router at some point (and then re added by the router so you can’t see it has changed but you loose the context) ?
Actually my problem has changed. Now what’s happening is when in my application I click on button “add event listener” and I double click on mesh it has offset in that moment. I don’t even need to switch routes. Also I noticed with every doubleclick on mesh it adds a lot of listeners.
Alright so if anybody will have a problem with this. This is the solution:
Firstly I got to change the way my red spheres where being taken. I changed it to use ray. There was so problems using scene.pick(scene.pointerX, scene.pointerY);
Secondly, there were some problems with CSS (wasn’t 100% width and height)