Hey there,

I’m trying to make a TopDown 2D Game with robots that have 6 legs.

I’m stuck at a problem where I’m trying to get a random point on the edge of a cone (blue line). I don’t want (cant) use ray casts and I don’t want to try hit random spots on the sphere until I get it inside the cone by chance.

These are the methods I tried, but they didn’t work and I couldn’t figure out why:

```
public static Vector2 PointOnConeEdgeRandom(Vector3 center, float radius, float minAngle, float maxAngle)
{
Quaternion randAng = Quaternion.Euler(0, Random.Range(minAngle, maxAngle + 1), 0);
return center + new Vector3(0, radius, 0) + randAng * Vector3.forward;
}
```

And:

```
public static Vector2 PointOnConeEdgeRandom(Vector3 center, float radius, float minAngle, float maxAngle)
{
var angle = Random.Range(minAngle, maxAngle + 1);
var point = new Vector3(radius, 0, 0);//Relativity
point = Quaternion.AngleAxis(angle, Vector3.forward) * point;
return center + point;
}
```

I need this to find a place where one of the foots goes. The foot its own gameobject so its not getting moved by a parent.