fix camera rotation
This commit is contained in:
parent
a0e7bb078a
commit
a6bbc2d683
|
|
@ -36,13 +36,13 @@ namespace RNR
|
||||||
Ogre::Radian old_yaw;
|
Ogre::Radian old_yaw;
|
||||||
Ogre::Radian old_roll;
|
Ogre::Radian old_roll;
|
||||||
|
|
||||||
getCFrame().getRotation().ToEulerAnglesZXY(old_yaw, old_pitch, old_roll);
|
getCFrame().getRotation().ToEulerAnglesYXZ(old_yaw, old_pitch, old_roll);
|
||||||
|
|
||||||
pitch = old_pitch + pitch;
|
pitch = old_pitch + pitch;
|
||||||
yaw = old_yaw - yaw;
|
yaw = old_yaw - yaw;
|
||||||
|
|
||||||
Ogre::Matrix3 rotation;
|
Ogre::Matrix3 rotation;
|
||||||
rotation.FromEulerAnglesZXY(yaw, pitch, Ogre::Radian(0));
|
rotation.FromEulerAnglesYXZ(yaw, pitch, Ogre::Radian(0));
|
||||||
getCFrame().setRotation(rotation);
|
getCFrame().setRotation(rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace RNR
|
||||||
snprintf(error_text, 255, "Attempt to set %s as its own parent", m_name.c_str());
|
snprintf(error_text, 255, "Attempt to set %s as its own parent", m_name.c_str());
|
||||||
throw std::runtime_error(error_text);
|
throw std::runtime_error(error_text);
|
||||||
}
|
}
|
||||||
if (isAncestorOf(newParent))
|
if (newParent && isAncestorOf(newParent))
|
||||||
{
|
{
|
||||||
snprintf(error_text, 255, "Attempt to set parent of %s to %s results in circular reference", newParent->getName().c_str(), m_name.c_str());
|
snprintf(error_text, 255, "Attempt to set parent of %s to %s results in circular reference", newParent->getName().c_str(), m_name.c_str());
|
||||||
throw std::runtime_error(error_text);
|
throw std::runtime_error(error_text);
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ namespace RNR
|
||||||
{
|
{
|
||||||
m_workspace->setCurrentCamera(0);
|
m_workspace->setCurrentCamera(0);
|
||||||
old_camera->setParent(NULL);
|
old_camera->setParent(NULL);
|
||||||
delete old_camera;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pugi::xml_document rbxl_doc;
|
pugi::xml_document rbxl_doc;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue