Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Instantiate objects evenly around a position.

Discussion in 'Scripting' started by StewVanB, May 11, 2012.

  1. StewVanB

    StewVanB

    Joined:
    Apr 12, 2011
    Posts:
    74
    Hello again!

    Lets say i have an object at point (0,0,0). And I want to instantiate objects around this object... Evenly

    by evenly i want..

    if i spawn 2 object for them to be on opposite sides of the point.
    if i spawn 3 objects the would be in each third
    etc...
    $SpawnQuestionGraphic.png

    like the image.

    not sure how to go about this, my current solution is to have an empty array of gameobjects to use as spawn locations... but this doesn't seem like the best way.

    any ideas?
     
    raquel08 likes this.
  2. _Petroz

    _Petroz

    Joined:
    May 13, 2010
    Posts:
    730
    Last edited: May 11, 2012
    FergJoe and raquel08 like this.
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Edit: Beaten! And his answer is better.
     
  4. StewVanB

    StewVanB

    Joined:
    Apr 12, 2011
    Posts:
    74
    Is it the same process for placing on a sphere around an object?
     
  5. FergJoe

    FergJoe

    Joined:
    Dec 28, 2016
    Posts:
    19