Random point in blue zone

  • A* version: 5.1.2
  • Unity version: 2022.3.36f
  • I want to generate a random point on the map. Is there a way for me to generate a point that only lies on the blue area?

You could use GetNearest - A* Pathfinding Project by passing it a random position within your desired range and it will return the closest node (in the blue area) to that position. You may get more near edge positions using this though.

Another way would be to keep generating random positions within your desired range until this function IsPointOnNavmesh - A* Pathfinding Project returns true.

1 Like

This page has various approaches for a similar problem: Wandering AI Tutorial - A* Pathfinding Project