Skip to content

Commit ffbea04

Browse files
committed
Added bus call to restore cursor's visibility
Signed-off-by: Patryk Antosz <[email protected]>
1 parent b7d5508 commit ffbea04

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Gems/RobotecSpectatorCamera/Code/Source/SpectatorCamera/SpectatorCameraComponent.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ namespace RobotecSpectatorCamera
2929
RobotecSpectatorCameraRequestBus::Handler::BusConnect(GetEntityId());
3030
AZ::TickBus::Handler::BusConnect();
3131
AzFramework::InputChannelEventListener::Connect();
32-
AzFramework::InputSystemCursorRequestBus::Event(
33-
AzFramework::InputDeviceMouse::Id,
34-
&AzFramework::InputSystemCursorRequests::SetSystemCursorState,
35-
AzFramework::SystemCursorState::ConstrainedAndHidden);
3632

3733
AZ::TransformBus::EventResult(m_currentTransform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
3834
}
@@ -119,6 +115,10 @@ namespace RobotecSpectatorCamera
119115
// Capture the initial mouse position and cursor state
120116
m_initialMousePosition = GetCurrentMousePosition();
121117
m_ignoreNextMovement = true; // Flag to ignore the next mouse movement preventing jump on re-centering
118+
AzFramework::InputSystemCursorRequestBus::Event(
119+
AzFramework::InputDeviceMouse::Id,
120+
&AzFramework::InputSystemCursorRequests::SetSystemCursorState,
121+
AzFramework::SystemCursorState::ConstrainedAndHidden);
122122
}
123123
else if (inputChannel.IsStateEnded())
124124
{
@@ -132,6 +132,10 @@ namespace RobotecSpectatorCamera
132132

133133
// Update m_lastMousePosition to the restored position to prevent the jump on the next rotation start
134134
m_lastMousePosition = m_initialMousePosition;
135+
AzFramework::InputSystemCursorRequestBus::Event(
136+
AzFramework::InputDeviceMouse::Id,
137+
&AzFramework::InputSystemCursorRequests::SetSystemCursorState,
138+
AzFramework::SystemCursorState::ConstrainedAndVisible);
135139
}
136140
}
137141

0 commit comments

Comments
 (0)