I have imported a human model mesh, with armature and animated it with mocap. What I exactly need is the position of its eyes at different frames.

              for f in frame_numbers:

                    eye_ob = bpy.data.objects[model+':Low-poly'] #eyes 
                    ob = bpy.data.objects[model]
                    scene.objects.active = eye_ob
                    scene.frame_set( f )
                    verts= eye_ob.data.vertices
                    print("right eyes ",verts[REyeIdx].co) #--this prints same value in all frames 
                    print("left eyes ", verts[LEyeIdx].co) #--this prints same value in all frames 
                    print("model pos" , ob.matrix_world.translation) #--this prints vector((0.0, 0.0, 0.0))
                    print("eye pos" ,  eye_ob.matrix_world.translation) #--this prints vector((0.0, 0.0, 0.0))

I am getting same 0,0,0 vector for object and its eye's positions. The coordinates of a specific vertex of eyes remains the same throughout the animation( not 0 vector). What could be the reason? How can I fix it? I saw related questions, but did not help.

  • $\begingroup$ You need to look at the pose bone locations. $\endgroup$ – batFINGER Mar 15 '17 at 12:41
  • $\begingroup$ Yes, pose bone works. but i need eye's location in specific, also ears and nose! $\endgroup$ – p.Neu Mar 15 '17 at 12:48
  • $\begingroup$ Add an empty with a vertex parent. The matrix_world.to_translation() "should" work on empty. $\endgroup$ – batFINGER Mar 15 '17 at 12:52
  • $\begingroup$ Sorry, I didn't get you. What should be empty? I am new to blender scripting $\endgroup$ – p.Neu Mar 15 '17 at 12:58
  • $\begingroup$ Add Object Empty and Parent to vertex $\endgroup$ – batFINGER Mar 15 '17 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.