i am trying to understand how to deal with units in Bjs regarding Camera Zoom.
Currently I am trying to display a plane containing a texture from a 1000x1000 px png file.
Now I would want to limit the camera zoom so that I cannot zoom past the native resolution of the image. Which in an image editing application would be 100%.
Is this at all possible or does the 3D logic prohbit such settings?
do you want to keep the image full screen? (Or will it be in 3D?)
Can you repro a mockup in the Playground to see how we can deal with it (Maybe a simple NME shader could do it)
Well it is basically this:
only with the zoom limitation to max 100% resolution of the the image file.
So the image will be in 3d.
Ok so if the image resolution is 500, you want to make sure that the plane width is 500pixels right?
So I would recommend adding a function on the scene.onBeforeRenderObservable.
In this function you can get the mesh.getBoundingInfo().boundingBox. It will give you minimumWorld and maximumWorld which will be the size in the world. You can then use the Vector3.Project function to get the screen size and evaluate if you should block the zoom or not
Does it make sense?