As the title says, I want to be able to check a location for the existence of an object. I'm randomly filling a space with objects and want to make sure I'm not placing an object somewhere that is already occupied. Current code is:
for x in range(1000):
loc = np.random.randint(-100, 100, 3)
bpy.ops.mesh.primitive_cube_add(size=2, view_align=False, enter_editmode=False, location=(loc[0],loc[1],loc[2]))
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
I'd like to add something like,
if NOT location(loc[0],loc[1],loc[2]):
add object...
Existing questions seem to be about getting location of known objects. I need the reverse of that - getting an object (or not) at a known location.
scene.objectsie all other objects in scene. The test could involve the overlapping of bounding box etc. – batFINGER Jan 04 '19 at 07:17(0.999999,) == (1,)It places a new sphere in a location that is available. There is a "tweak" to edge them away from the other if slightly overlapping. All this is simplest with spheres. The beauty of scripts is you can run them to see how they work. I've updated the code to also work in 2.8 if you are using that version, which I would suggest you do if you are just starting. – batFINGER Jan 04 '19 at 10:40