Topic: Best Camera Distance for Full Screen Map

When using OnlineMapsTileSetControl on a RawImage that is layouted to full screen and using the AdjustToScreen component at least the TileSet.SizeInScene is automatically set. However how positioning the MapCamera is still to be done manually. I use the code

_MapCamera.transform.position = new Vector3(
    _TileSet.sizeInScene.x / -2,
    mapCameraDistance,
    _TileSet.sizeInScene.y / 2 );

This centers the camera as desired but I don't have a way of calculating the Y value (distance of the camera over the RenderTexture) so that there is

a) no black area
b) the as few area as possibile overlaps the screen

Is there a method to get this distance?

Re: Best Camera Distance for Full Screen Map

Hello.

The easiest way is to use Camera Orbit component.
If you don't need rotation, just set Lock Pan to ON, Lock Tilt to ON.

If you want to calculate it manually:

mapCameraDistance = screenHeight * 0.8f;
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Best Camera Distance for Full Screen Map

Hi Alex,

I used Camera Orbit with Lock Pan and Lock Tilt ON and removed my custom code. Thanks that worked!

We should mention that this scaling is intended for the default camera FOV of 60. Actually 65 also stays "full screen" in all resolutions. The FOV=99 I had in place before, leaves 30% of black borders around the map.