Topic: Markers stop moving to player??
Good morning, I'm intending to move a marker towards a target and when it is on the way, it stops completely.
My team and I are developing a game with mechanics similar to pokemon go. I want to move a marker (enemy) to my position but when setting small speeds (to make it as real as possible) it stops.
the zoom of my map is 17;
Here are some lines of code:
void moveEnemy()
{
var speed = 0.003f //a little slower than player walking on the street.
Vector2 firstPos = myMarker.position;
float distance= OnlineMapsUtils.DistanceBetweenPoints(myMarkerFirstPos, player.myMarker.position).magnitude;
while (distance>= 0.05f) //50mts close
{
miMarcador.position = Vector2.Lerp(myMarker.position, player.myMarker.position, speed);
OnlineMaps.instance.Redraw();
}
}
ty for help guys