Search Unity

Place randomly objects

Discussion in 'Scripting' started by sevennemesis, Dec 18, 2014.

  1. sevennemesis

    sevennemesis

    Joined:
    Dec 18, 2014
    Posts:
    2
    I all, today I would like to learn a little thing

    ok, I have a empty square room with three walls and a floor ( isometric view ). Every walls have 4 empty place in which they can add with various decorative objects.

    at the beginning of each level, I would like the piece is embellished with random objects. I would like the 8x8 floor can randomly receive a maximum of 30 objects such as barrels, stone or item.

    I have difficulty expressing myself in English, but if you have any questions, ask me.

     
  2. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    If you want a little control, you can set object points like you appear to have for the torches. In unity, make an empty called "item positions" and then start adding transforms to it as children. Move each transform to a spot where you'd like objects to be able to be created. Then in a script, choose random children from that group and instantiate items in their position.

    That's the easiest approach I've learned & taught for having random spawning with a little control and not too much coding.
     
  3. sevennemesis

    sevennemesis

    Joined:
    Dec 18, 2014
    Posts:
    2