Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

How do I ask an Agent if he's reached his close enough distance to his PathManager's move target?
  • jcrouchjcrouch February 9
    I have the following code in my scripts:

    PathManager pathMan = gameObject.GetComponent().Agent.PathManager;
    Vector3 dirToTarget = pathMan.moveTarget.TransformTarget.transform.position - gameObject.transform.position;
    if ( dirToTarget.magnitude <= pathMan.closeEnoughDistance ) {<br />// we made it!
    }

    however, we never make it. The agent stops slightly before the close enough distance. (for example: my C.E.D. is 0.1 but the dirToTarget.magnitude is 0.233f).

    Is there a handy callback or otherway to identify when the agent gets to his target location and stops?

    Also, I tried placing the code above in a [code][/code] to no avail. Mind mentioning the correct syntax?
  • jcrouchjcrouch February 9
    I see I can check agent.Agent.Kinematic.Velocity against Vector3.zero. But is that the most appropriate way to get what I'm looking for?