Forums › 💬 NodeCanvas › ⚙️ Support › [BUG] Wander.cs
In Wander.cs looks like squared min needed because comapared vs sqrMagnitude?
min
sqrMagnitude
while ( ( wanderPos – agent.transform.position ).sqrMagnitude < min ) { wanderPos = ( Random.insideUnitSphere * max ) + agent.transform.position; }
Hello,
Hmm. This is exactly how the code actually is right now (same as the one you posted).
Can you please clarify your change (or do you by any chance use an old version) ? Thank you.
I made no changes – I posted exactly your code. But I think it must read min * min.
min * min
Like this:
var sqrMin = min * min; while ( ( wanderPos – agent.transform.position ).sqrMagnitude < sqrMin ) { wanderPos = ( Random.insideUnitSphere * max ) + agent.transform.position; }
Oh.. you are right. Thanks for the fix. Apparently I missed that 🙂