Hello,
I'm looking for how to rotate an object coordinate system so that a chosen axis (from the object coordinate system) is normal to an object face.
Thanks in advance for your help.
Rotate object coordinate system
Moderators: jesterKing, stiv
maybe this helps:
http://wiki.blender.org/index.php/Exten ... cise_Align
otherwise, it's possible to write a python addon to do so, i'm just a little unsure about normal vector to rotation matrix conversion (rather math problem)
http://wiki.blender.org/index.php/Exten ... cise_Align
otherwise, it's possible to write a python addon to do so, i'm just a little unsure about normal vector to rotation matrix conversion (rather math problem)
I'm sitting, waiting, wishing, building Blender in superstition...
i'm stuck at the required math, basically rotation matrix construction :/
however, i know how to do the rest
rough outline:
this might be relevant for the mat construction:
http://www.gamedev.net/topic/602485-dir ... on-matrix/
however, i know how to do the rest

rough outline:
Code: Select all
active_ob = bpy.context.active_object
sel_obs = bpy.context.selected_objects
sel_obs.remove(active_ob)
me = active_ob.data
face_normal = me.polygons[me.polygons.active].normal
# construct rotation matrix
for ob in sel_obs:
ob.matrix_world *= rot_mat
http://www.gamedev.net/topic/602485-dir ... on-matrix/
I'm sitting, waiting, wishing, building Blender in superstition...