mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 23:41:34 +00:00
Fix RotateController not updating skeleton
This commit is contained in:
parent
2288a691d2
commit
ceabeab0fd
1 changed files with 12 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "rotatecontroller.hpp"
|
#include "rotatecontroller.hpp"
|
||||||
|
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
|
#include <osgAnimation/Bone>
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
@ -40,9 +41,19 @@ namespace MWRender
|
||||||
osg::Quat orient = worldOrient * mRotate * worldOrientInverse * matrix.getRotate();
|
osg::Quat orient = worldOrient * mRotate * worldOrientInverse * matrix.getRotate();
|
||||||
matrix.setRotate(orient);
|
matrix.setRotate(orient);
|
||||||
matrix.setTrans(matrix.getTrans() + worldOrientInverse * mOffset);
|
matrix.setTrans(matrix.getTrans() + worldOrientInverse * mOffset);
|
||||||
|
|
||||||
node->setMatrix(matrix);
|
node->setMatrix(matrix);
|
||||||
|
|
||||||
|
// If we are linked to a bone we must call setMatrixInSkeletonSpace
|
||||||
|
osgAnimation::Bone* b = dynamic_cast<osgAnimation::Bone*>(node);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
osgAnimation::Bone* parent = b->getBoneParent();
|
||||||
|
if (parent)
|
||||||
|
b->setMatrixInSkeletonSpace(matrix * parent->getMatrixInSkeletonSpace());
|
||||||
|
else
|
||||||
|
b->setMatrixInSkeletonSpace(matrix);
|
||||||
|
}
|
||||||
|
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue