Hi,
We are starting to work with this tool and I have a few questions:
- I have a large top-down open world. There are locations on the map, such as a factory, a military base, etc. I would like the most enemies (zombies) to appear in these places, and much fewer in open areas - 30:10 - is a local grid solution a good solution?
- In runtime, is it enough to add an opponent on the map and he will be able to handle it? NavMeshAgent`s from Unity need to be targeted at navmesh to add correctly, do I have to do the same here?
That’s it for now.
Regards
Vector3 PickRandomPoint()
{
Vector2 randomDirection = Random.insideUnitCircle * maxWanderingArea;
Vector3 point = initialPosition + new Vector3(randomDirection.x, 0, randomDirection.y);
if (IsPointInWalkableArea(point))
{
return point;
}
else
{
Debug.LogWarning("Generated point is not in a walkable area. Retrying...");
return PickRandomPoint();
}
}
When its start i save initialPosition
of zombie
PickRandomPoint()
- find random point in area from this point to maxWanderingArea
Then check if this point in on walkable area
bool IsPointInWalkableArea(Vector3 point)
{
GraphNode node = AstarPath.active.GetNearest(point).node;
return node != null && node.Walkable;
}
if not - find another, if is - move to this point. Now i need make spawner with probability system