I want to use Random.insideUnitCircle to spawn my enemy around a specific object. However, I don’t really… know how to do that.
I have it assign a new position based on what Random.InsideUnitCircle finds, but it doesn’t work as planned. I’d like for this scripting to be in the enemy script, and not attached to the other gameobject, if possible.
*note, even though I script in Boo, feel free to script it in whatever else you like. I know how to convert between the three languages.
This is the current script
if dist > 60:
newPosition as Vector2 = Random.insideUnitCircle * 60
transform.position.x = newPosition.x
transform.position.y = newPosition.y
powerPillar as GameObject // Set in the editor
if dist > 60:
newPosition as Vector2 = Random.insideUnitCircle * 60 + powerPillar.transform.position
transform.position.x = newPosition.x
transform.position.y = newPosition.y
The enemy just moves around the pillar, but he constantly does it multiple times. It is under Update, but it should still only do it once, since after that, he should be within 60.
Hi all how can I use Random.insideUnitCircle to get a random position outside of the origin range?
for Example if I wanted to spawn objects in a random position inside the UnitCircle but not in the origin point or 5 units from origin how would the math / look like?