I drew schematically
Black is any part
Red is a area where to see spawned parts is undesirable (5 parts radius maybe)
Green is a free area to spawn somehere here
Without it looks like part into another part. If random spawns part in another part.
I drew schematically
Black is any part
Red is a area where to see spawned parts is undesirable (5 parts radius maybe)
Green is a free area to spawn somehere here
Without it looks like part into another part. If random spawns part in another part.
I believe you can use Region3s in this situation:
You can loop through all of the existing parts, and check if the magnitude between the wanted position and the part’s position is less than the radius. If it is, you know it is within some part’s range, and therefore give up on the current position, randomize another position, until it finds a valid position.
Instead of looking for random positions, i would divide world on a grid and then use langtons ant algorithm.
(ask me if you’re interested)