fix: remove scene view orbit roll
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <XCEngine/Components/TransformComponent.h>
|
||||
#include <XCEngine/Core/Math/Math.h>
|
||||
#include <XCEngine/Core/Math/Quaternion.h>
|
||||
#include <XCEngine/Core/Math/Vector3.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -94,7 +95,10 @@ public:
|
||||
|
||||
void ApplyTo(Components::TransformComponent& transform) const {
|
||||
transform.SetPosition(GetPosition());
|
||||
transform.LookAt(m_focalPoint);
|
||||
transform.SetRotation(Math::Quaternion::FromEulerAngles(
|
||||
-m_pitchDegrees * Math::DEG_TO_RAD,
|
||||
m_yawDegrees * Math::DEG_TO_RAD,
|
||||
0.0f));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,8 +34,11 @@ TEST(SceneViewportCameraController_Test, ApplyToMatchesComputedPositionAndForwar
|
||||
controller.ApplyTo(*cameraObject.GetTransform());
|
||||
|
||||
EXPECT_TRUE(NearlyEqual(cameraObject.GetTransform()->GetPosition(), controller.GetPosition()));
|
||||
const Vector3 localFocus = cameraObject.GetTransform()->InverseTransformPoint(controller.GetFocalPoint());
|
||||
EXPECT_GT(localFocus.z, 0.0f);
|
||||
EXPECT_TRUE(NearlyEqual(
|
||||
cameraObject.GetTransform()->GetForward().Normalized(),
|
||||
controller.GetForward(),
|
||||
1e-3f));
|
||||
EXPECT_GT(Vector3::Dot(cameraObject.GetTransform()->GetUp().Normalized(), Vector3::Up()), 0.0f);
|
||||
}
|
||||
|
||||
TEST(SceneViewportCameraController_Test, ApplyInputUpdatesOrbitPanAndZoomState) {
|
||||
|
||||
Reference in New Issue
Block a user