Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

March 14, 2013

world coordinates from local coordinates

you could make it a sequence of assignments
om = object_matrix
lc = local_coordinate
world_coordinate = om * lc
you'll have something like this:

import bpy

this_object = bpy.data.objects['Cube']

om = this_object.matrix_world
lc = this_object.data.vertices[1].co
world_coordinate = om * lc

print(world_coordinate)

2 comments:

  1. hello
    I get an error from blender saying one matrix is 3x3 the other is 4x4, how do you manage that ?
    thanks

    ReplyDelete
    Replies
    1. Matrices have methods to convert them from 3*3 to 4*4 and back. See http://www.blender.org/api/blender_python_api_2_73_release/mathutils.html#mathutils.Matrix . If what you are trying to multiply is giving an error I highly recommend learning more about Matrix-Matrix multiplication and Matrix-Vector multiplication (KhanAcademy has good lessons)

      Delete

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.