I’ m writing a script in which it requires the average (or ‘mean’) coordinates of all selected objects and create another object in the centre of these. I know how to do it manually however it is time consuming and I would like to automate the process. Anyone have any ideas on how this would work?
import bpy
obj= [i.location for i in bpy.context.selected_objects]
x = 0
y = 0
z = 0
for i in obj:
x += i[0]
y += i[1]
z += i[2]
l = len(obj)
bpy.context.scene.cursor_location = (x/l,y/l,z/l)