Skip to content
Permalink
Browse files

OGRE-450 - Incorrect normalizing

  • Loading branch information...
Eugene Golushkov Eugene Golushkov
Eugene Golushkov authored and Eugene Golushkov committed Feb 22, 2016
1 parent d401d41 commit 8dc543fcdff408e6a389e535f420587c07d0dbae
Showing with 10 additions and 10 deletions.
  1. +3 −3 OgreMain/src/OgreCamera.cpp
  2. +7 −7 OgreMain/src/OgreNode.cpp
@@ -313,9 +313,9 @@ namespace Ogre {
// Note the order of the mult, i.e. q comes after

// Normalise the quat to avoid cumulative problems with precision
Quaternion qnorm = q;
qnorm.normalise();
mOrientation = qnorm * mOrientation;
Quaternion qres = q * mOrientation;
qres.normalise();
mOrientation = qres;

invalidateView();

@@ -543,26 +543,26 @@ namespace Ogre {
//-----------------------------------------------------------------------
void Node::rotate(const Quaternion& q, TransformSpace relativeTo)
{
// Normalise quaternion to avoid drift
Quaternion qnorm = q;
qnorm.normalise();

switch(relativeTo)
{
case TS_PARENT:
// Rotations are normally relative to local axes, transform up
mOrientation = qnorm * mOrientation;
mOrientation = q * mOrientation;
break;
case TS_WORLD:
// Rotations are normally relative to local axes, transform up
mOrientation = mOrientation * _getDerivedOrientation().Inverse()
* qnorm * _getDerivedOrientation();
* q * _getDerivedOrientation();
break;
case TS_LOCAL:
// Note the order of the mult, i.e. q comes after
mOrientation = mOrientation * qnorm;
mOrientation = mOrientation * q;
break;
}

// Normalise quaternion to avoid drift
mOrientation.normalise();

needUpdate();
}

0 comments on commit 8dc543f

Please sign in to comment.
You can’t perform that action at this time.