<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Markers stop moving to player??]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=683&amp;type=atom" />
	<updated>2017-10-19T23:19:06Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=683</id>
		<entry>
			<title type="html"><![CDATA[Re: Markers stop moving to player??]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2939#p2939" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Your code will not work:<br />1. It contains an infinite loop (you do not update the distance), and you just freeze your application.<br />2. Redraw does not redraw the map right now. It simply marks that the map needs to be redrawn. Drawing will starts later.<br />3. You use Lerp incorrectly, and your enemy will move fast at a big distance (at the beginning) and slowly at a small distance (at the end).</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-10-19T23:19:06Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2939#p2939</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Markers stop moving to player??]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2937#p2937" />
			<content type="html"><![CDATA[<p>Good morning, I&#039;m intending to move a marker towards a target and when it is on the way, it stops completely.</p><p>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.</p><p>the zoom of my map is 17; </p><p>Here are some lines of code:</p><div class="codebox"><pre><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&gt;= 0.05f) //50mts close 
        {
            miMarcador.position = Vector2.Lerp(myMarker.position, player.myMarker.position, speed);
            OnlineMaps.instance.Redraw();
            
        }

    }</code></pre></div><p>ty for help guys</p>]]></content>
			<author>
				<name><![CDATA[ppizarro]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=553</uri>
			</author>
			<updated>2017-10-19T20:21:01Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2937#p2937</id>
		</entry>
</feed>
