- Home /
Random object placement.
Hello at first. I've got a question about terrains. I have got 10 terrain templates and ı want to place them randomly. Infinite map that goes on and on. for example;
object is going 100 blocks (I don't know what term do we use for pixel at 3d universe) and map ends. I want to create a 100 block wide terrain again randomly. I hope i can explain it well. Somebody can help me ? thanks a lot.
Answer by Deeweext · Jul 11, 2013 at 03:36 PM
If you have an array of objects, you can pick random(0,length of array). This gives you a random tile (?) and then you place them / instantiate them at the given world coordinates (vector3), like if you have a 10 by 10, you can do two loops, so looping 1 to 10, and for each loop 1 to 10, that gives you all 100 positions (or multiply with some number to get the right positions) then use that for the position parameter of the instantiate.
Your answer
![](https://koobas.hobune.stream/wayback/20220613105918im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Tree position on random Terrain (y axis) 0 Answers
2D random object placement 0 Answers
Random Object Spawnning? 1 Answer
Object collision with terrain 0 Answers
How does Mathf.PerlinNoise Work? 4 Answers