Add customization point for begin/end of camera behaviors (hide cursor with RMB look) (#1758)
* add customization points for begin/end of camera input to all cursor customization Signed-off-by: hultonha <hultonha@amazon.co.uk> * remove cursor experiments, use cursor bus Signed-off-by: hultonha <hultonha@amazon.co.uk> * run clang-format Signed-off-by: hultonha <hultonha@amazon.co.uk> * add additional unit tests for new camera behaviors Signed-off-by: hultonha <hultonha@amazon.co.uk> * update test name to use snake_case to increase readability Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
committed by
GitHub
parent
9f61ed426c
commit
dafe9f6690
@@ -45,6 +45,7 @@
|
||||
#include <AzToolsFramework/Manipulators/ManipulatorManager.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
// AtomToolsFramework
|
||||
#include <AtomToolsFramework/Viewport/RenderViewportWidget.h>
|
||||
@@ -1244,11 +1245,24 @@ AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateMod
|
||||
controller->SetCameraListBuilderCallback(
|
||||
[viewportId](AzFramework::Cameras& cameras)
|
||||
{
|
||||
const auto hideCursor = [viewportId]
|
||||
{
|
||||
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
|
||||
viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture);
|
||||
};
|
||||
const auto showCursor = [viewportId]
|
||||
{
|
||||
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
|
||||
viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture);
|
||||
};
|
||||
|
||||
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraFreeLookButton);
|
||||
firstPersonRotateCamera->m_rotateSpeedFn = []
|
||||
{
|
||||
return SandboxEditor::CameraRotateSpeed();
|
||||
};
|
||||
firstPersonRotateCamera->SetActivationBeganFn(hideCursor);
|
||||
firstPersonRotateCamera->SetActivationEndedFn(showCursor);
|
||||
|
||||
auto firstPersonPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraFreePanButton, AzFramework::LookPan);
|
||||
|
||||
Reference in New Issue
Block a user