I don't understand this line in the Get Started tutorial

I understand the whole examples pretty good, except when it comes to this specific line:

lastRepath = Time.time+ Random.value*repathRate*0.5f;

Why do you calculate the last repath time by multiplying the repath rate by a random value and then halving it by multiplying by 0.5?

Thanks

Hi

Huh. That looks like some testing code that I have forgotten to remove.
It looks like the purpose would be to add some randomness to how often the agent recalculates its path.
You can change the line to

lastRepath = Time.time;

and it should work just as well I think.

1 Like

Thanks Aron, I thought it was one of those moments where one is missing something very obvious.