[BUG] Wander.cs

Forums 💬 NodeCanvas ⚙️ Support [BUG] Wander.cs

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16280
    anton petrov
    Participant

      In Wander.cs looks like squared min needed because comapared vs sqrMagnitude?

      while ( ( wanderPos – agent.transform.position ).sqrMagnitude < min ) {
      wanderPos = ( Random.insideUnitSphere * max ) + agent.transform.position;
      }

      #16283
      Gavalakis
      Keymaster

        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.

        #16282
        anton petrov
        Participant

          I made no changes – I posted exactly your code. But I think it must read min * min.

          Like this:

          var sqrMin = min * min;
          while ( ( wanderPos – agent.transform.position ).sqrMagnitude < sqrMin ) {
          wanderPos = ( Random.insideUnitSphere * max ) + agent.transform.position;
          }

          #16281
          Gavalakis
          Keymaster

            Oh.. you are right. Thanks for the fix. Apparently I missed that 🙂

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.