Blender‎ > ‎blog‎ > ‎

Blender 2.5x : Scripting : Getting the World Coordinates

posted Jan 29, 2011, 5:36 PM by Satish Goda   [ updated Mar 14, 2013, 2:52 AM ]
A question was asked on Learning Blender 2.5 Facebook page about the process of getting the world coordinates of a control vertex on a curve. Following was my answer

How do we visualize the local and world coordinates for object location, vertex location?

Note: For all the examples on this page
  1. I have used a BezierCurve object with three control vertices.
  2. The curve object has been translated along the +x direction by 1 unit and also rotated it around in space.
  3. The curve object is not parented to any other object.

Local coordinates of the control vertex

The control vertex's local coordinates are those values that are stored with respect to the curve objects transformation (in other words, in Object Space)

The Local Coordinates will be different than the Global Coordinates, If the object to which the vertices belong has been transformed (scaled, rotated, translated)
Global (World) coordinates of the control vertex

The control vertex's global/world coordinates are those values that are obtained after taking into consideration the transformation of the curve object. These values are with respect to the World Coordinate System in Blender.

The Local Coordinates and World Coordinates will be the same if the object is not transformed.

Since the time this tutorial was written, the order of operations for multiplying matrices and vectors/points has changed in Blender. Please follow the code at the link below for the updates.
Updates to the tutorial

How can we do it using Python?

Copy/Paste the code

import mathutils

wmtx = bpy.context.active_object.matrix_world

localCoord =[0].bezier_points[1].co

worldCoord = localCoord * wmtx

To learn more about vector and matrix operation that you can perform, read the manual