I´m comming from 3ds max and I would like to rebuild a scene in blender. It has a controller that outputs the angle between a bone and the world z-axis via the dot product function. That´s pretty simple in 3ds Max with e.g
> myvec=$.transform.row1 globalz=[0,0,1] theAngle = acos(dot (normalize
> myvec) (normalize globalz))
The script controller calculates the angle between the bones X-axis(roll axis) and the world z-axis. This works for realtime tranformations and animations as well.
How could I make this with a blender driver?
So far I have written a script which is running in the console line by line(sorry for the noobish syntax)
import bpy
import mathutils
import math
from mathutils import Matrix, Vector
myvec=bpy.data.objects['Armature'].pose.bones['Bone'].matrix.col[1]
gloma= Matrix()
ori=gloma.col[2]
ori=ori.dot(myvec)
ori=math.acos(ori)
ori=math.degrees(ori)
print (ori)
After I had created a driver function with bpy.app.driver_namespace
that driver didn´t got evaluated. Any help would be very appreciated.