Skip to main content
2 of 2
code formatting
Ray Mairlot
  • 29.4k
  • 12
  • 105
  • 126

Generate x cubes at random locations but not inside each other?

I'm generating cubes with this code:

for a in range(10):
    x = random.randint(-5, 4)
    y = random.randint(-2, 7)
    z = random.randint(3, 10)
    bpy.ops.mesh.primitive_cube_add(location=(x,y,z), radius = 1)`

What do I add to make sure no one of these 10 cubes are created with some part of it inside of one of the earlier created cubes?