What would be best solution for adding different sized objects to world?
Hello,
I am working on a game where I use different sized objects - such as houses, trees etc. My question is, which way should I determine is the place I am going to place my object free or not? World is generated randomly every time the game is launched.
(I'm only using x and z coordinates) For example, I have tree in a item pool with a size of 10x10, in the location 10, 0, 10 and I am going to add a stone which is size 5x5 for example. So how do I tell the stone "hey you can't place yourself to coordinates from 5 to 15 on x axis and 5 to 15 on z axis, place somewhere else".
Yes a simple way would be to just write down all the coordinates which are taken (5,6,7 ... 14,15), but what if I have 1000 trees? Is there any better and faster way to locate free spot for the item other than looping through a list of coordinates which have also looped to be written in taking a slot?
Thanks in advance, K
Your answer
Follow this Question
Related Questions
How to generate list of hexagonal coordinates? 2 Answers
Move an object's position based on how you're facing? 1 Answer
Most efficient way to find the closest collider to a player? 1 Answer
Was the audio file embed into the scene asset bundle file? 0 Answers
24m tri 50m verts from 300 trees 2 Answers