Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / can i apply quaternion rotations to a model in MB?
  RSS 2.0 ATOM  

can i apply quaternion rotations to a model in MB?
Rate this thread
 
40385
 
Permlink of this thread   Subscribe to this thread
avatar
  • Location: Los Angeles CA
  • Total Posts: 93
  • Joined: 16 May 2008 02:40 AM

Hi,

I’m reading quaternion rotation values from a file and I need to apply them to a model in my scene. Is this possible? I have read the help, but not sure how? This doesn’t work:

AssetRot FBVector4d(float(Rot1),float(Rot2),float(Rot3),float(Rot4))
AssetLocator
.QuaternionInterpolate True
AssetLocator
.SetVector(AssetRot)

This might be way off. I don’t even know if I need to use the vector4d class, can’t find much in the help…

thx,
Brian



MotionBuilder 7.5 thru ...
3dsMax 2.5 thru ...

Replies: 0
avatar

Maybe I did this the hard way but I imported the math module and found the formulas online. Here is how I converted Quaternians to Eulers in case anyone needs it in the future:

RotZ math.atan2(2*((Quat0)*(Quat1) (Quat2)*(Quat3)),(2)*((Quat1)*(Quat1) (Quat2)*(Quat2)))
RotZ 
math.degrees(RotZ)
RotY 
math.asin(2*((Quat0)*(Quat2) (Quat3)*(Quat1)))
RotY 
math.degrees(RotY)
RotX 
math.atan2((2*((Quat0)*(Quat3) (Quat1)*(Quat2))),(1 (2)*((Quat2)*(Quat2) (Quat3)*(Quat3))))
RotX 
math.degrees(RotX)


MotionBuilder 7.5 thru ...
3dsMax 2.5 thru ...

Replies: 0




   
  Settings Choose Theme color: