Update default camera orbit behavior (#5301)

* add new default orbit point behavior

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* add default orbit distance to settings registry

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* add new default orbit point behavior

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* add default orbit distance to settings registry

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* expose default orbit distance to editor settings menu and update how we display default camera position

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* add improve orbit changes for focus

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>
This commit is contained in:
Tom Hulton-Harrop
2021-11-08 09:19:40 +00:00
committed by GitHub
parent 425e172079
commit 783186fa7e
8 changed files with 68 additions and 49 deletions
@@ -174,7 +174,7 @@ namespace SandboxEditor
return SandboxEditor::CameraScrollSpeed();
};
const auto pivotFn = []
const auto pivotFn = []() -> AZStd::optional<AZ::Vector3>
{
// use the manipulator transform as the pivot point
AZStd::optional<AZ::Transform> entityPivot;
@@ -187,8 +187,13 @@ namespace SandboxEditor
return entityPivot->GetTranslation();
}
// otherwise just use the identity
return AZ::Vector3::CreateZero();
return AZStd::nullopt;
};
const auto orbitFn = [pivotFn](const AZ::Vector3& pivotFallback = AZ::Vector3::CreateZero())
{
// return the pivot otherwise use the fallback
return pivotFn().value_or(pivotFallback);
};
m_firstPersonFocusCamera =
@@ -199,9 +204,9 @@ namespace SandboxEditor
m_orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>(SandboxEditor::CameraOrbitChannelId());
m_orbitCamera->SetPivotFn(
[pivotFn]([[maybe_unused]] const AZ::Vector3& position, [[maybe_unused]] const AZ::Vector3& direction)
[orbitFn]([[maybe_unused]] const AZ::Vector3& position, [[maybe_unused]] const AZ::Vector3& direction)
{
return pivotFn();
return orbitFn(position + direction * SandboxEditor::CameraDefaultOrbitDistance());
});
m_orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraOrbitLookChannelId());