Rotate object coordinate system

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

dom107
Posts: 35
Joined: Wed Apr 18, 2012 10:04 am

Rotate object coordinate system

Postby dom107 » Sat Oct 27, 2012 6:06 pm

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.

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Sun Oct 28, 2012 5:25 pm

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)
I'm sitting, waiting, wishing, building Blender in superstition...

dom107
Posts: 35
Joined: Wed Apr 18, 2012 10:04 am

Postby dom107 » Sun Oct 28, 2012 10:22 pm

I was wondering if I had not missed something in Blender functions: well a script is needed for what I'm looking for.

Thanks for the link to the script.
It works but the workflow is somewhat complicated.

I might be writing a script.

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Mon Oct 29, 2012 1:55 pm

i'm stuck at the required math, basically rotation matrix construction :/

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


this might be relevant for the mat construction:
http://www.gamedev.net/topic/602485-dir ... on-matrix/
I'm sitting, waiting, wishing, building Blender in superstition...

dom107
Posts: 35
Joined: Wed Apr 18, 2012 10:04 am

Postby dom107 » Mon Nov 05, 2012 2:34 pm

I started a script and posted about a few problems here


Return to “Interface & Tools”

Who is online

Users browsing this forum: No registered users and 1 guest