On 30/05/2017 at 20:14, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;
I'm working on a plugin using the FBX SDK, but I'm having a terrible time of figuring out the matirx calculations to get my joints rotated right. Obviously the C4D importer works somehow, so I was wondering if anyone had any hints or tips on the way FBX works vs C4D. I've came up with some conclusions based on my research: C4D is left-handed and FBX is right handed. When I'm doing my translation setup I've inverted the z axis and so the positions of the joint are proper. Rotations are a bit of a bastard though. Here's some code I'm using to set up the global matrix for a joint
FbxAMatrix fbxMatrix; fbxMatrix = fbxNode->EvaluateGlobalTransform(kTime); Matrix base; base.v1.x = fbxMatrix.Get(0, 0); base.v1.y = fbxMatrix.Get(0, 1); base.v1.z = fbxMatrix.Get(0, 2); base.v2.x = fbxMatrix.Get(1, 0); base.v2.y = fbxMatrix.Get(1, 1); base.v2.z = fbxMatrix.Get(1, 2); base.v3.x = fbxMatrix.Get(2, 0); base.v3.y = fbxMatrix.Get(2, 1); base.v3.z = fbxMatrix.Get(2, 2); base.off.x = fbxMatrix.Get(3, 0); base.off.y = fbxMatrix.Get(3, 1); base.off.z = -fbxMatrix.Get(3, 2);
Considering the handedness I imagine I have to do some interesting to the rotations but I don't know what. Setting the properties use SetAbsRot, SetAbsPos, SetAbsScale isn't working out too well for me either due to those function being local to thier parent. Maybe there's a setglobalpos I'm missing somewhere? The whole base * the inverse of the parent to make things local also failed for me.