Use a hack to get the "real" transformation for bones
Sometimes the value return before was not as correct as in blender Todo: expose it in mesh interface
This commit is contained in:
parent
1a250c5b74
commit
d6d1fa40c0
@ -1225,16 +1225,19 @@ void KartModel::initInverseBoneMatrices()
|
|||||||
m_model_filename.c_str());
|
m_model_filename.c_str());
|
||||||
striaght_frame = 0.0f;
|
striaght_frame = 0.0f;
|
||||||
}
|
}
|
||||||
node->setCurrentFrame(striaght_frame);
|
|
||||||
const unsigned total_joint = node->getJointCount();
|
const unsigned total_joint = node->getJointCount();
|
||||||
for (unsigned i = 0; i < total_joint; i++)
|
for (unsigned i = 0; i < total_joint; i++)
|
||||||
{
|
{
|
||||||
|
node->setCurrentFrame(striaght_frame);
|
||||||
node->OnAnimate(0);
|
node->OnAnimate(0);
|
||||||
scene::IBoneSceneNode* bone = node->getJointNode(i);
|
scene::IBoneSceneNode* bone = node->getJointNode(i);
|
||||||
bone->updateAbsolutePosition();
|
bone->updateAbsolutePosition();
|
||||||
const core::matrix4 mat = bone->getAbsoluteTransformation();
|
node->setCurrentFrame(striaght_frame);
|
||||||
|
node->OnAnimate(0);
|
||||||
|
bone->updateAbsolutePosition();
|
||||||
core::matrix4 inv;
|
core::matrix4 inv;
|
||||||
mat.getInverse(inv);
|
bone->getAbsoluteTransformation().getInverse(inv);
|
||||||
const std::string bone_name = bone->getName();
|
const std::string bone_name = bone->getName();
|
||||||
auto ret = m_inverse_bone_matrices.find(bone_name);
|
auto ret = m_inverse_bone_matrices.find(bone_name);
|
||||||
if (ret != m_inverse_bone_matrices.end())
|
if (ret != m_inverse_bone_matrices.end())
|
||||||
|
Loading…
Reference in New Issue
Block a user