Nodrev
09-09-2010 15:32:42
Hi,
I use a node hierarchy in my application, so the nodes associated to the bodies do not have for direct parent the Root scene Node.
But, the position and orientation of nodes are setted localy, instead of global space, and it results sometimes a difference beetween the physic position and the visual object position.
Here the correction, to apply the position and orientation in global space terms (compatible for Ogre 1.6.x and 1.7.x):
Can't commit it, so i let the concerned people to apply this patch
I use a node hierarchy in my application, so the nodes associated to the bodies do not have for direct parent the Root scene Node.
But, the position and orientation of nodes are setted localy, instead of global space, and it results sometimes a difference beetween the physic position and the visual object position.
Here the correction, to apply the position and orientation in global space terms (compatible for Ogre 1.6.x and 1.7.x):
// In "void Body::updateNode(Ogre::Real interpolatParam)" function)
//m_node->setPosition(m_nodePosit);
//m_node->setOrientation(m_nodeRotation);
// Set position in global terms.
Ogre::Node* m_nodeParent = m_node->getParent();
m_node->setPosition((m_nodeParent->_getDerivedOrientation().Inverse() * (m_nodePosit - m_nodeParent->_getDerivedPosition()) / m_nodeParent->_getDerivedScale()));
m_node->setOrientation((m_nodeParent->_getDerivedOrientation().Inverse() * m_nodeRotation));
Can't commit it, so i let the concerned people to apply this patch