Community
KTime kTime;
kTime.SetSecondDouble(0);
FbxAMatrix Transform = Node->EvaluateLocalTransform(kTime);
FbxVector4 Translation = Transform.GetT();
FbxQuaternion QuatRotation = Transform.GetQ();
FbxVector4 Angles = Transform.GetR();
FbxVector4 Scale = Transform.GetS();
NewNode->Translation = Translation;
NewNode->Translation = Translation;
NewNode->Translation = Translation;
NewNode->Rotation = QuatRotation;
NewNode->Rotation = QuatRotation;
NewNode->Rotation = QuatRotation;
NewNode->Rotation = QuatRotation;
NewNode->Scale = Scale;
NewNode->Scale = Scale;
NewNode->Scale = Scale;
// Evaluate the node at the given time
KTime kTime;
kTime.SetSecondDouble(Time);
FbxAMatrix Transform = m_pFBXNode->EvaluateLocalTransform(kTime);
FbxVector4 Translation = Transform.GetT();
FbxQuaternion QuatRotation = Transform.GetQ();
FbxVector4 Scale = Transform.GetS();
// Make the values relative to time of 0
kTime.SetSecondDouble(0);
FbxAMatrix Frame0Transform = m_pFBXNode->EvaluateLocalTransform(kTime);
FbxVector4 Frame0Translation = Frame0Transform.GetT();
FbxQuaternion Frame0QuatRotation = Frame0Transform.GetQ();
FbxVector4 Frame0Scale = Frame0Transform.GetS();
FbxAMatrix InverseFrame0Transform = Frame0Transform.Inverse();
FbxAMatrix RelativeTransform = InverseFrame0Transform * Transform;
Translation = RelativeTransform.GetT();
QuatRotation = RelativeTransform.GetQ();
Scale = Transform.GetS() - Frame0Scale;
Keyframe = (float)Translation;
Keyframe = (float)Translation;
Keyframe = (float)Translation;
Keyframe = (float)QuatRotation;
Keyframe = (float)QuatRotation;
Keyframe = (float)QuatRotation;
Keyframe = (float)QuatRotation;
Keyframe = (float)Scale;
Keyframe = (float)Scale;
Keyframe = (float)Scale;
// Store the inverse bind pose matrix
FbxAMatrix globalMatrix;
Cluster->GetTransformMatrix(globalMatrix);
const FbxVector4 GeomTranslation = Mesh->GetNode()->GetGeometricTranslation(FbxNode::eSourcePivot);
const FbxVector4 GeomRotation = Mesh->GetNode()->GetGeometricRotation(FbxNode::eSourcePivot);
const FbxVector4 GeomScaling = Mesh->GetNode()->GetGeometricScaling(FbxNode::eSourcePivot);
FbxAMatrix geomMatrix = FbxAMatrix(GeomTranslation, GeomRotation, GeomScaling);
globalMatrix *= geomMatrix;
FbxAMatrix bindPoseMatrix;
Cluster->GetTransformLinkMatrix(bindPoseMatrix);
bindPoseMatrix = bindPoseMatrix.Inverse() * globalMatrix;
// We need to transpose the matrix to get it into engine format
FbxMatrix tempMatrix(bindPoseMatrix);
FbxMatrix transposedBindPoseMatrix = tempMatrix.Transpose();
double* bindPoseMatrixData = (double*)transposedBindPoseMatrix;
array<float>^ invBindPoseMatrix = gcnew array<float>(16);
for(int arrayIndex = 0; arrayIndex < 16; ++arrayIndex)
{
invBindPoseMatrix = (float)bindPoseMatrixData;
}
NewBoneData->SetInvBindPoseMatrix(invBindPoseMatrix);
// Get the transformation for the bone
const MathsNS::Matrix4x4& boneTransform = pNodeInstance->GetTransform();
// Get the inverse transform for the original bone node
const MathsNS::Matrix4x4& invBoneTransform = CurrentMesh->m_BoneInvBindPoseMatrices;
// Set the shader parameter for this bone
boneMatrices.push_back(boneTransform * invBoneTransform);
boneMatrices.push_back(Matrix4x4::Identity);
// Evaluate the node at the given time
KTime kTime;
kTime.SetSecondDouble(Time);
FbxAMatrix Transform = m_pFBXNode->EvaluateLocalTransform(kTime);
for(int componentIndex = 0; componentIndex < 16; ++componentIndex)
{
Keyframe = (float)(((FbxDouble*)Transform));
}
Can't find what you're looking for? Ask the community or share your knowledge.