I’d like to limit my ArcRotateCamera, so that only the top half of the scene can be seen.
Setting camera.upperBetaLimit to 90° almost does the trick, but you can still pan underneath the horizontal surface.
See this PG example, where you shouldn’t be able to see the red surface, but you can
I tried some alternatives, but wasn’t really satisfied with the results:
panningAxis = new BABYLON.Vector3(1,0,1): quite different panning UX, also not being able to pan in Y at all is quite a drawback
using cameraCollisions: a bit of an overkill, also one needs an additional mesh, which size is synced with the camera limits
So what about adding a camera limit, like upper/lowerTargetX/Y/Z?
Adding the limits into the _checkLimits funciton should already work very conveniently IMO.
I made a quick and dirty POC implementation in the PG example (commented lines on the bottom).
well I forgot to mention, the solution should be serializable.
We are about to create .babylon files with some default settings for lighting, ground, camera behaviour, etc…
The plan is to load this file in our scenes (configurators), to have a good scene setup right away without having to code anything.
I think it can be a very useful feature, especially in combination with the default ground, created via scene.createDefaultEnvironment.
…where you probably don’t want to “dive” into the ground mesh.
I am very willing to create a PR.
However I am not sure how far to go.
My use case would be solved with a single lowerTargetYLimit property.
Maybe just skip limits for target x/z and upper limits for now?
The more generic approach would be to define planes with infinite size via position and normal vector, as you are not limited to the default directions x/y/z.
But that’s quite similar to a checkCollisions setup I’d say.