Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Animation mess

0 REPLIES 0
Reply
Message 1 of 1
MwRain
300 Views, 0 Replies

Animation mess

Hi all!
I've been trying to get the correct animation values of an .fbx file.
I've tried 4 different methods so far, but none seems to work as expected.
The code given here, gets only the first key of the curves, so to be able to compare the first three methods' output with the foruth's. Normally, I'd get the data from all the keys.

// Method 1:
FbxAnimCurve *translationXCurve = fbxNode->LclTranslation.GetCurve(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
if (translationXCurve != 0)
{
if (translationXCurve->KeyGetCount() > 0)
{
translationVectorComponentX= translationXCurve->KeyGetValue(0);
time = translationXCurve->KeyGetTime(0).GetSecondDouble();
}
}
// And so on for FBXSDK_CURVENODE_COMPONENT_Y and FBXSDK_CURVENODE_COMPONENT_Z and respectively for rotation and scaling.

I'm putting my hopes on this method, but it results in getting some bones' transformations wrong, also there are situations when some of the components of a curve are null and some are not. For example, a translation curve that has null X component, but valid Y and Z. What mostly bothers me in this case is that fbxNode->LclTranslation.Get() returns values with components different than the values which the valid curve components have returned (in this case, Y and Z).

// Method2:
FbxAnimCurve *translationCurve = fbxNode->LclTranslation.GetCurve(animLayer);
if (translationCurve != 0)
{
if (translationCurve->KeyGetCount() > 0)
{
FbxAnimEvaluator *animEvaluator = fbxScene->GetAnimationEvaluator();
FbxTime frameTime = translationCurve->KeyGetTime(0);
translationVector = animEvaluator->GetNodeLocalTranslation(fbxNode, frameTime);
// Method3:
translationVector = fbxNode->EvaluateLocalTranslation(frameTime);
}
}

Method2 and Method3 seem to be equivalent and seem to work best, though only for .fbx with baked animations. However they are both very slow, about 20 times slower than Method1. And generally, I'm looking for the original keyframe data rather than evaluated interpolations. In case the curve is null or has no keys, I get data as single key from fbxNode->LclTranslation.Get()

// Method4:
translationVector = fbxNode->LclTranslation.Get();

Assuming it gets only the first key, I use it to compare with the other methods. Models look ok with it, but of course, not animated

Could someone help me with this? What is the correct approach? I don't know what else to try..
Thanks!

P.S. and uh.. any hint about how to get the curves' parameters to reproduce the curves' functions?
Thanks again and sorry for the long post

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report