Camera moving when reenabling gameplay

Cheo

Active member
Hello, when disabling gameplay using the OnEnableGameplayInput and then reenabling it, if the camera was moving when gameplay was disabled it will move slightly following its last direction when gameplay is reenabled. Here is a video to demonstrate.


It's not a big thing, but it still annoys me a lot. Hope someone can explain how to prevent this movement or propose a better gameplay interruption method. Thanks in advance.
 
I just tested this out by adding the following to a new scripts Update method within the demo scene:

Code:
            if (Input.GetKeyDown(KeyCode.O)) {
                EventHandler.ExecuteEvent(m_Character, "OnEnableGameplayInput", false);
            }

            if (Input.GetKeyDown(KeyCode.P)) {
                EventHandler.ExecuteEvent(m_Character, "OnEnableGameplayInput", true);
            }

I pressed O to disable gameplay input. Then I moved the mouse around and pressed P. When the gameplay input was enabled again the camera didn't move into position at all.
 
I'm afraid setting the time scale to 0 has no effect, as you can see in this test video. I tried modifying the time scale before and after the two OnEnableGameplayInput events, with no difference. And in any case, freeezing time should not be a solution here, I'd like to be able to disable and reenable gameplay input as simply as possible, without pausing anything else.


Did you press O while moving the mouse ? Disabling gameplay input while moving it is what causes the issue, if you disable gameplay input while the mouse is not moving there will be no camera movement when gameplay is enabled again, no matter how much you move it between the two events - after all, any mouse movement made during this interval will be ignored since input is disabled.
 
Did you press O while moving the mouse ? Disabling gameplay input while moving it is what causes the issue, if you disable gameplay input while the mouse is not moving there will be no camera movement when gameplay is enabled again, no matter how much you move it between the two events - after all, any mouse movement made during this interval will be ignored since input is disabled.
Ah, that is the key. If you change line 519 of PlayerInput from:
Code:
                m_RawLookVector = m_CurrentLookVector = Vector3.zero;
to:
Code:
                m_RawLookVectorAccumulation = m_RawLookVector = m_CurrentLookVector = Vector3.zero;
That'll fix it. Thanks for letting me know.
 
Yes, that fixed it ! Thank you VERY much, this didn't look like a big thing but it was really annoying for my gameplay/cutscenes transitions ! Just hope you can add this fix for the next update or for UCC3.
 
Top