In another question I ask How to make these scripted duplivert monkeys always face “out” using duplicates? Here I would like to ask if there is a better (or at least alternate) way to do this besides using duplicates or "dupliverts".
Here's an example using dupliverts - the same as in the other question and so far I haven't figured out there how to get the monkeys placed on the icosphere's vertices or it's faces to face "out".
Is there a different way to do this?
note: I will not always use monkeys on icospheres - this is an abstraction. I'm working towards correctly animating this constellation of 4,425 Earth-facing satellites where I'll have roughly eighty rotating circles with sixty "monkeys" each. However I will also be using 2D meshes in a second project (rather than circles), so I really want to understand the underlying logic/math of the orientations, both on 1D (circles) and 2D meshes.
edit: Here is one of the images from the linked satellite question to help illustrate why I want to create "monkeys" (satellites) in groups, and not create and keyframe four thousand individuals:
Potentially adjustable things:
# monkey.rotation_euler = 0, 0, pi # ??
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True) # keep_transform ??
bpy.context.object.use_dupli_vertices_rotation = True # ??
Ok here is a basic script:
import bpy, math
pi = math.pi
loco_f, loco_v = (-5, 0, 5), (+5, 0, 5)
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)
bpy.ops.mesh.primitive_ico_sphere_add(location=loco_f, size=4, subdivisions=2)
shape_mesh_f = bpy.context.active_object
bpy.ops.mesh.primitive_ico_sphere_add(location=loco_v, size=4, subdivisions=2)
shape_mesh_v = bpy.context.active_object
bpy.ops.mesh.primitive_monkey_add(radius=1, location=loco_f)
monkey_f = bpy.context.active_object
# monkey.rotation_euler = 0, 0, pi
bpy.ops.mesh.primitive_monkey_add(radius=1, location=loco_v)
monkey_v = bpy.context.active_object
# monkey.rotation_euler = 0, 0, pi
bpy.ops.object.select_all(action='DESELECT')
monkey_f.select = True
bpy.context.scene.objects.active = shape_mesh_f
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)
bpy.context.object.dupli_type = 'FACES'
bpy.context.object.use_dupli_vertices_rotation = True
bpy.ops.object.select_all(action='DESELECT')
monkey_v.select = True
bpy.context.scene.objects.active = shape_mesh_v
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)
bpy.context.object.dupli_type = 'VERTS'
bpy.context.object.use_dupli_vertices_rotation = True





rot = v.normal.to_track_quat('-Y','Z')seems to be an interesting lead, I'll try to start learning about whatnormal_to_track_quatactually means. and WOW!! Animation nodes - that sounds really interesting!! – uhoh Nov 20 '16 at 10:54to_track_quatturns the vector from the normals into an axis based rotation that you can use. Animation nodes will let you add rotation changes during your animation, add a time info node to use the frame in calculating to animate loc/rot. – sambler Nov 20 '16 at 13:33bmesh.opsnotbpy.ops!! I misread, which then sent me off in the wrong direction - my mistake. Actually the all-in-one mesh is a really interesting solution if the shape mesh is permanent, I like it very much! But this lacks the flexibility of being able to animate the shape mesh, unless somehow store (or calculate) the group of vertices corresponding to each repeat and then.. dunno. I like this solution but I really do want to learn how to do what I've actually asked also. I can split the question into two: "how to duplivert?" & "a better way than duplivert?" – uhoh Nov 20 '16 at 15:28