Removing the Movement Pause


(Erik Horner) #1

Hello,

I have recently picked up the NavMap2 package and successfully integrated it into my project using some variations of the Sample4 code. So far, it works very all and I am very happy with it. However, I would like to remove the slight pause each unit takes while moving from node to node but it’s not jumping out at me where this is located in the code. Has anyone out come across and solved this particular issue?


(Leslie Young) #2

Sample4 uses Vector3.Lerp() to move the unit. This might be what causes the “slow down” since it waits to reah the end of the Lerp before deciding on a new destination.

You’d have to change the movement code. MapNav provides a path with the nodes to go to. So use the positions from these and create a controller which goes from position to position without stopping.


(Erik Horner) #3

Ah ha! That makes sense. I’ll just have to take the less lazy route and write my own handler. Thanks!


(Leslie Young) #4

lol, ye. Those examples are to demonstrate how to use the core system rather than provide the final controllers for moving units around.


#5

transform.position = Vector3.MoveTowards(transform.position, targetPos, .1f);

I did it like this and it seems to be fairly smooth, if someone knows a better way I would love to know :slight_smile: