i want to place a mesh in 3d space as a child of my camera. But it’s position has to be relative to the screen size. Let’s say i want to pin it on the left upper corner with a margin of 10% screen.width and 10% screen.height. If i now resize the window it should stay in the same place on the screen and scale accordingly. Any ideas how to do that? I can’t use GUI elements, as it has to be a mesh. And i also can’t just place a rendered image of the object, because it is interactive.
This sounds very tricky indeed. This topic parse(convert)toVector3 ( by reference to canvas or viewport. ) looked at a similar problem and playing around with one of the PGs allows you to re-size the screen and maintain a spheres position as in https://playground.babylonjs.com/#JQJ8UM#7. HOWEVER the camera is not attached to the canvas. Attaching the camera moves the sphere as the camera moves. It might help but then again it could be a red herring. Hopefully others more knowledgeable may have more ideas.
Thanks for your answers, i already have found another solution for myself, as I am using a perspective camera. But i will have a look at @nedcrow solution too