Reputation:
I need to select a random point inside a radius to send an enemy in a Unity game while they wait for their turn to attack. How do I create a radius around my gameobject and randomly select points inside it?
Upvotes: 0
Views: 2631
Reputation: 2130
Vector3 centerOfRadius = new Vector3(5, 3, 0);
float radius = 10f;
Vector3 target = centerOfRadius + (Vector3)(radius * UnityEngine.Random.insideUnitCircle);
Upvotes: 2