I am trying to rotate an object using python, inline with a vector which gives me the direction I want (based on the difference between the last two coordinates of the curve I generated). I therefore have a vector which I'd like to align this object but not the XYZ angles. The options to specify rotation (XYZ Euler...) all seem to require some sort of angle definition. I've started playing with numpy with I'm not experienced enough to find the answer.
Would you be able to advise what would be the best way to align an object to a vector and (if necessary) how I could convert the vector coordinates in XYZ_Euler angles I could apply to the object?
for instance, Vector=[1,1,1] and I would like to rotate the object along this vector.
Thanks for your help
update
Thanks guys, DirectionVector.to_track_quat('X', 'Z')
did the trick very nicely!
#define direction
Vector=(1,1,1)
DirectionVector = mathutils.Vector(Vector)
#apply rotation
bpy.context.object.rotation_mode = 'QUATERNION'
bpy.context.object.rotation_quaternion = DirectionVector.to_track_quat('Z','Y')