From a6bbc2d68307280aa4f5cf73612cc6f4bf0a4b64 Mon Sep 17 00:00:00 2001 From: floralrainfall Date: Wed, 19 Jul 2023 00:06:37 -0400 Subject: [PATCH] fix camera rotation --- Projects/Engine/Source/App/V8/DataModel/Camera.cpp | 4 ++-- Projects/Engine/Source/App/V8/Tree/Instance.cpp | 2 +- Projects/Engine/Source/App/V8/World/World.cpp | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Projects/Engine/Source/App/V8/DataModel/Camera.cpp b/Projects/Engine/Source/App/V8/DataModel/Camera.cpp index a774847..76b1486 100644 --- a/Projects/Engine/Source/App/V8/DataModel/Camera.cpp +++ b/Projects/Engine/Source/App/V8/DataModel/Camera.cpp @@ -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); } diff --git a/Projects/Engine/Source/App/V8/Tree/Instance.cpp b/Projects/Engine/Source/App/V8/Tree/Instance.cpp index 3246090..21e757a 100644 --- a/Projects/Engine/Source/App/V8/Tree/Instance.cpp +++ b/Projects/Engine/Source/App/V8/Tree/Instance.cpp @@ -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); diff --git a/Projects/Engine/Source/App/V8/World/World.cpp b/Projects/Engine/Source/App/V8/World/World.cpp index e625958..4dc0d31 100644 --- a/Projects/Engine/Source/App/V8/World/World.cpp +++ b/Projects/Engine/Source/App/V8/World/World.cpp @@ -84,7 +84,6 @@ namespace RNR { m_workspace->setCurrentCamera(0); old_camera->setParent(NULL); - delete old_camera; } pugi::xml_document rbxl_doc;