1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Technology' started by Andreas Ringstad, Aug 2, 2020.

Tags: Add Tags
  1. 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?

    Login To add answer/comment

Share This Page