Skip to content

Commit

Permalink
fix camera rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
floralrainfall committed Jul 19, 2023
1 parent a0e7bb0 commit a6bbc2d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Projects/Engine/Source/App/V8/DataModel/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ namespace RNR
Ogre::Radian old_yaw;
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;
yaw = old_yaw - yaw;

Ogre::Matrix3 rotation;
rotation.FromEulerAnglesZXY(yaw, pitch, Ogre::Radian(0));
rotation.FromEulerAnglesYXZ(yaw, pitch, Ogre::Radian(0));
getCFrame().setRotation(rotation);
}

Expand Down
2 changes: 1 addition & 1 deletion Projects/Engine/Source/App/V8/Tree/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace RNR
snprintf(error_text, 255, "Attempt to set %s as its own parent", m_name.c_str());
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());
throw std::runtime_error(error_text);
Expand Down
1 change: 0 additions & 1 deletion Projects/Engine/Source/App/V8/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ namespace RNR
{
m_workspace->setCurrentCamera(0);
old_camera->setParent(NULL);
delete old_camera;
}

pugi::xml_document rbxl_doc;
Expand Down

0 comments on commit a6bbc2d

Please sign in to comment.