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
@@ -806,12 +806,20 @@ namespace AzFramework
[[maybe_unused]] float scrollDelta,
[[maybe_unused]] float deltaTime)
{
const auto pivot = m_pivotFn();
if (!pivot.has_value())
{
EndActivation();
return targetCamera;
}
if (Beginning())
{
// as the camera starts, record the camera we would like to end up as
m_nextCamera.m_offset = m_offsetFn(m_pivotFn().GetDistance(targetCamera.Translation()));
m_nextCamera.m_offset = m_offsetFn(pivot.value().GetDistance(targetCamera.Translation()));
const auto angles =
EulerAngles(AZ::Matrix3x3::CreateFromMatrix3x4(AZ::Matrix3x4::CreateLookAt(targetCamera.Translation(), m_pivotFn())));
EulerAngles(AZ::Matrix3x3::CreateFromMatrix3x4(AZ::Matrix3x4::CreateLookAt(targetCamera.Translation(), pivot.value())));
m_nextCamera.m_pitch = angles.GetX();
m_nextCamera.m_yaw = angles.GetZ();
m_nextCamera.m_pivot = targetCamera.m_pivot;
@@ -651,7 +651,7 @@ namespace AzFramework
class FocusCameraInput : public CameraInput
{
public:
using PivotFn = AZStd::function<AZ::Vector3()>;
using PivotFn = AZStd::function<AZStd::optional<AZ::Vector3>()>;
FocusCameraInput(const InputChannelId& focusChannelId, FocusOffsetFn offsetFn);