hello,
im trying to rotate an object from its current position where its local Z vector is Z(0,0,1) to another orientation where its local Z points along vector V(x,y,z). I thought that I could accomplish it by using axis angle rotation mode, setting the angle equal to acos(|V|dot|Z|) and the axis equal to ||V| cross |Z||, but the object does not seem to rotate properly. All the API calls work fine, and the result in transform properties matches up to my calculations, but visually the transformation does not look right.
am I going about this completely wrong? is there a quick way in blender python to set a rotation by setting vectors for the object’s local axes?
thanks in advance,
Josh
…where zupnew and zupold are the two normalised vectors
math.acos(zupnew.dot(zupold))
aa_axis=zupnew.cross(zupold)
aa_axis.normalize()
bpy.context.selected_editable_objects[0].rotation_mode='AXIS_ANGLE'
bpy.context.selected_editable_objects[0].rotation_axis_angle[0]=aa_ang
bpy.context.selected_editable_objects[0].rotation_axis_angle[1]=aa_axis[0]
bpy.context.selected_editable_objects[0].rotation_axis_angle[2]=aa_axis[1]
bpy.context.selected_editable_objects[0].rotation_axis_angle[3]=aa_axis[2]