|
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 ...
|
|
|
|
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)),1 - (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 ...
|
|
|