mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 15:45:37 +00:00
Merge branch 'i-didnt-want-to-grow-up-to-be-this-big' into 'master'
FIX: Incorrect scaling applied when creatures rotate (close #6665) Closes #6665 See merge request OpenMW/openmw!4219
This commit is contained in:
commit
81e59bb4aa
@ -44,6 +44,7 @@
|
|||||||
Bug #6550: Cloned body parts don't inherit texture effects
|
Bug #6550: Cloned body parts don't inherit texture effects
|
||||||
Bug #6574: Crash at far away from world origin coordinates
|
Bug #6574: Crash at far away from world origin coordinates
|
||||||
Bug #6645: Enemy block sounds align with animation instead of blocked hits
|
Bug #6645: Enemy block sounds align with animation instead of blocked hits
|
||||||
|
Bug #6665: The kobolds in the skyrim: home of the nords mod are oversized
|
||||||
Bug #6657: Distant terrain tiles become black when using FWIW mod
|
Bug #6657: Distant terrain tiles become black when using FWIW mod
|
||||||
Bug #6661: Saved games that have no preview screenshot cause issues or crashes
|
Bug #6661: Saved games that have no preview screenshot cause issues or crashes
|
||||||
Bug #6716: mwscript comparison operator handling is too restrictive
|
Bug #6716: mwscript comparison operator handling is too restrictive
|
||||||
|
@ -2042,7 +2042,8 @@ namespace MWMechanics
|
|||||||
float effectiveRotation = rot.z();
|
float effectiveRotation = rot.z();
|
||||||
bool canMove = cls.getMaxSpeed(mPtr) > 0;
|
bool canMove = cls.getMaxSpeed(mPtr) > 0;
|
||||||
const bool turnToMovementDirection = Settings::game().mTurnToMovementDirection;
|
const bool turnToMovementDirection = Settings::game().mTurnToMovementDirection;
|
||||||
if (!turnToMovementDirection || isFirstPersonPlayer)
|
const bool isBiped = mPtr.getClass().isBipedal(mPtr);
|
||||||
|
if (!isBiped || !turnToMovementDirection || isFirstPersonPlayer)
|
||||||
{
|
{
|
||||||
movementSettings.mIsStrafing = std::abs(vec.x()) > std::abs(vec.y()) * 2;
|
movementSettings.mIsStrafing = std::abs(vec.x()) > std::abs(vec.y()) * 2;
|
||||||
stats.setSideMovementAngle(0);
|
stats.setSideMovementAngle(0);
|
||||||
@ -2286,7 +2287,7 @@ namespace MWMechanics
|
|||||||
|
|
||||||
// It seems only bipedal actors use turning animations.
|
// It seems only bipedal actors use turning animations.
|
||||||
// Also do not use turning animations in the first-person view and when sneaking.
|
// Also do not use turning animations in the first-person view and when sneaking.
|
||||||
if (!sneak && !isFirstPersonPlayer && mPtr.getClass().isBipedal(mPtr))
|
if (!sneak && !isFirstPersonPlayer && isBiped)
|
||||||
{
|
{
|
||||||
if (effectiveRotation > rotationThreshold)
|
if (effectiveRotation > rotationThreshold)
|
||||||
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight;
|
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight;
|
||||||
@ -2296,7 +2297,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (turnToMovementDirection && !isFirstPersonPlayer
|
if (turnToMovementDirection && !isFirstPersonPlayer && isBiped
|
||||||
&& (movestate == CharState_SwimRunForward || movestate == CharState_SwimWalkForward
|
&& (movestate == CharState_SwimRunForward || movestate == CharState_SwimWalkForward
|
||||||
|| movestate == CharState_SwimRunBack || movestate == CharState_SwimWalkBack))
|
|| movestate == CharState_SwimRunBack || movestate == CharState_SwimWalkBack))
|
||||||
{
|
{
|
||||||
@ -2330,7 +2331,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mPtr.getClass().isBipedal(mPtr))
|
if (isBiped)
|
||||||
{
|
{
|
||||||
if (mTurnAnimationThreshold > 0)
|
if (mTurnAnimationThreshold > 0)
|
||||||
mTurnAnimationThreshold -= duration;
|
mTurnAnimationThreshold -= duration;
|
||||||
|
@ -35,12 +35,25 @@ namespace MWRender
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
osg::Matrix matrix = node->getMatrix();
|
osg::Matrix matrix = node->getMatrix();
|
||||||
osg::Quat worldOrient = getWorldOrientation(node);
|
|
||||||
|
osg::Quat worldOrient;
|
||||||
|
osg::Vec3d worldScale(1.0, 1.0, 1.0);
|
||||||
|
|
||||||
|
osg::NodePathList nodepaths = node->getParentalNodePaths(mRelativeTo);
|
||||||
|
|
||||||
|
if (!nodepaths.empty())
|
||||||
|
{
|
||||||
|
osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]);
|
||||||
|
worldOrient = worldMat.getRotate();
|
||||||
|
worldScale = worldMat.getScale();
|
||||||
|
}
|
||||||
|
|
||||||
osg::Quat worldOrientInverse = worldOrient.inverse();
|
osg::Quat worldOrientInverse = worldOrient.inverse();
|
||||||
|
|
||||||
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 *= osg::Matrix::scale(worldScale);
|
||||||
|
|
||||||
node->setMatrix(matrix);
|
node->setMatrix(matrix);
|
||||||
|
|
||||||
@ -57,18 +70,4 @@ namespace MWRender
|
|||||||
|
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Quat RotateController::getWorldOrientation(osg::Node* node)
|
|
||||||
{
|
|
||||||
// this could be optimized later, we just need the world orientation, not the full matrix
|
|
||||||
osg::NodePathList nodepaths = node->getParentalNodePaths(mRelativeTo);
|
|
||||||
osg::Quat worldOrient;
|
|
||||||
if (!nodepaths.empty())
|
|
||||||
{
|
|
||||||
osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]);
|
|
||||||
worldOrient = worldMat.getRotate();
|
|
||||||
}
|
|
||||||
return worldOrient;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,6 @@ namespace MWRender
|
|||||||
void operator()(osg::MatrixTransform* node, osg::NodeVisitor* nv);
|
void operator()(osg::MatrixTransform* node, osg::NodeVisitor* nv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
osg::Quat getWorldOrientation(osg::Node* node);
|
|
||||||
|
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
osg::Vec3f mOffset;
|
osg::Vec3f mOffset;
|
||||||
osg::Quat mRotate;
|
osg::Quat mRotate;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user