1 (edited by danielesuppo 2019-05-12 01:12:29)

Topic: Map redraw on new floatZoom value;

Hello, I'd like to zoom the map a little when some gameobject is clicked.
To do so I'm using this simple Lerp

OnlineMaps.instance.floatZoom = Mathf.Lerp(initZoom, 16, t);

The problem is that the map is zoomed, but is not updated to the new zoom level (16).

How can I update by script the map to zoom level 16?

Many thanks

Re: Map redraw on new floatZoom value;

Hello.

When using Lerp, the result will tend to the target value, but will never be equal to it.
Add some threshold:

float newZoom = Mathf.Lerp (initZoom, 16, t);
if (16 - newZoom < 0.01f) newZoom = 16;
map.floatZoom = newZoom;
Kind Regards,
Infinity Code Team.

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

Re: Map redraw on new floatZoom value;

Right! Thank-you!