Announcement

Collapse
No announcement yet.

[C++] Disabling player input for menus

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [C++] Disabling player input for menus

    I have a UMG menu that can be brought up in game but the player can still look around and there is no cursor. Manually setting bShowMouseCursor = true; and InputMode = EInputMode::EIM_UIOnly didn't work.

    I figure that is because AUTBasePlayerController::UpdateInputMode() immediately overrides my setting with UUTLocalPlayer::AreMenusOpen(). Is that right?

    If that's the case how would I disable the input?
    Last edited by Crafty; 09-15-2015, 08:07 PM.
    C++: Spray prototype | Compilation Tweaks | Maps: Quayside (inactive)

    #2
    This is what you want, but you need to find the corresponding C++ function.
    > FreezeTag [Blueprint]
    > Reimagining of Greed [BluePrint]
    > Avarice, a DM-variant of Greed [BluePrint]

    Comment


      #3
      Found it - it's just SetIgnoreLookInput().

      It does the job, though it isn't exactly what I wanted since you can still fire guns. Thanks though.
      C++: Spray prototype | Compilation Tweaks | Maps: Quayside (inactive)

      Comment


        #4
        About disabling guns you can tackle it via two routes:

        1) Use DisallowWeaponFiring on your Pawn. This can get the job done in a simple manner, but it doesn't disable the sounds/animations due to replication issues, it only affects not being able to consume ammo and deal damage.
        2) Create a custom PlayerState that utilizes EnableInput and DisableInput and use the InputAction StartFire and InputAction StartAltFire events with Consume Input and Override Parent Binding properties.
        The two events actually consume the primary and alternate fire inputs, thus it results in not being able to fire when the PlayerState resides in the input stack. EnableInput and DisableInput basicly adds/removes the PlayerState from input stack, so you can control when you want this to happen. The positive side is that you can replace firing with whatever actions that you wish (in FreezeTag's case it's the spectating system), the downside is that it doesn't affect bots because they use the AI Controller instead.

        Of course I'm speaking again with blueprint terms, it's up to you to find the corresponding C++ functions.
        Last edited by FrostbyteGR; 09-18-2015, 12:10 PM.
        > FreezeTag [Blueprint]
        > Reimagining of Greed [BluePrint]
        > Avarice, a DM-variant of Greed [BluePrint]

        Comment


          #5
          Hi Crafy, you need to use both SetIgnoreLookLinput and SetIgnoreMoveInput (pass true for both) on your PlayerController, hope it helps.

          Comment

          Working...
          X