Fixed: KRNode::getWorldRotation() was returning erroneous euler angles.

This commit is contained in:
2013-02-01 16:16:19 -08:00
parent 232fadce11
commit 1f82b62367

View File

@@ -195,7 +195,12 @@ const KRVector3 KRNode::getWorldScale() {
return KRMat4::DotNoTranslate(getModelMatrix(), m_localScale);
}
const KRVector3 KRNode::getWorldRotation() {
return KRMat4::DotNoTranslate(getModelMatrix(), m_localRotation);
KRVector3 world_rotation = m_localRotation;
if(m_parentNode) {
KRVector3 parent_rotation = m_parentNode->getWorldRotation();
world_rotation = (KRQuaternion(world_rotation) * KRQuaternion(parent_rotation)).eulerXYZ();
}
return world_rotation;
}
std::string KRNode::getElementName() {