mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 13:20:35 +00:00
FIX(rotatecontroller): Account for parent node scale when rotating objects
This commit is contained in:
parent
b1de8ed720
commit
c95c7503a8
@ -40,7 +40,8 @@ namespace MWRender
|
||||
|
||||
osg::Quat orient = worldOrient * mRotate * worldOrientInverse * matrix.getRotate();
|
||||
matrix.setRotate(orient);
|
||||
matrix.setTrans(matrix.getTrans() + worldOrientInverse * mOffset);
|
||||
|
||||
matrix *= osg::Matrix::scale(getParentScale(node));
|
||||
|
||||
node->setMatrix(matrix);
|
||||
|
||||
@ -71,4 +72,14 @@ namespace MWRender
|
||||
return worldOrient;
|
||||
}
|
||||
|
||||
osg::Vec3d RotateController::getParentScale(osg::Node* node)
|
||||
{
|
||||
osg::NodePathList nodepaths = node->getParentalNodePaths(mRelativeTo);
|
||||
if (!nodepaths.empty())
|
||||
{
|
||||
return osg::computeLocalToWorld(nodepaths[0]).getScale();
|
||||
}
|
||||
return osg::Vec3d(1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace MWRender
|
||||
|
||||
protected:
|
||||
osg::Quat getWorldOrientation(osg::Node* node);
|
||||
osg::Vec3d getParentScale(osg::Node* node);
|
||||
|
||||
bool mEnabled;
|
||||
osg::Vec3f mOffset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user