Search Unity

  1. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  2. Unity 2017.1 is now released.
    Dismiss Notice
  3. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  4. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

Instantiate objects evenly around a position.

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

  1. wolftamer389

    wolftamer389

    Joined:
    Apr 12, 2011
    Posts:
    67
    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?
     
  2. _Petroz

    _Petroz

    Joined:
    May 13, 2010
    Posts:
    731
    Last edited: May 11, 2012
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    9,707
    Edit: Beaten! And his answer is better.
     
  4. wolftamer389

    wolftamer389

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