[solved] rotation problem

Hello,

I try to generate lamps that positioned at the center of the faces (of the selected object(s)).
The problem I encounter is related to the rotation of the lamps, as I want them to have the same “direction” as the normal vector of the faces, which i would like to realise with the use of quaternions.

I based my tryout on the reply of “theeth” on http://blenderartists.org/forum/showthread.php?t=89470

The euler values i get from the quaternion seem to be OK, but the sign of some istn’t, and i just can’t find where it goes wrong.

The files can be found at :
http://ghamon.studentenweb.org/angleprobl.png
http://ghamon.studentenweb.org/tunnellight.txt
http://ghamon.studentenweb.org/tunnellight.blend

Thank you all for helping me out here.

geoffrey.

Just found it…
I had to take into account the rotation of the current object

oRotation = oMatrix.rotationPart()
normVect = (Blender.Mathutils.Vector(f.no)*oRotation)

thanks anyway
g