Advertisement
Guest User

Navmesh Agent script snipet

a guest
Apr 28th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. try {
  2. // Move the nav agent
  3. var navPoint = navMesh.NavMeshQuery.FindNearestPoly(ToSV3(transform.position), ToSV3(Vector3.one * 2));
  4. agent.Position = navPoint.Position;
  5.  
  6. navPoint = navMesh.NavMeshQuery.FindNearestPoly(ToSV3(destination), ToSV3(Vector3.one * 2));
  7. agent.RequestMoveTarget(navPoint.Polygon, navPoint.Position);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement