Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
611 B
3
Indexable
Never
Vector3 PickRandomPoint(float radius, float min)
        {
            if (radius == min) return new Vector3(0,0); 

            var point = Random.insideUnitSphere * radius;
            float x = point.x + LastPosition2.x;
            float y = point.y + LastPosition2.y;



            if ((x < transform.position.x + min && x > transform.position.x - min) 
              | (y < transform.position.y + min && y > transform.position.y - min))
            { point = PickRandomPoint(radius, min); Debug.Log("działa"); }
            else point += LastPosition2;
            return point;
        }