Search Unity

Question Unable to retrieve value of manually Queued stick event

Discussion in 'Input System' started by IndyNarf, Apr 26, 2023.

  1. IndyNarf

    IndyNarf

    Joined:
    Sep 8, 2015
    Posts:
    7
    Hello,
    I have difficulties to understand how the queing of event of the input system works.

    For the context we are trying to implement a way to record inputs then replay them. Our system needs to be replayed on the exact same fixed frame it was first played. We were not able to obtain this with the InputSystem record/replay system so we are looking at ways to do it ouserlves.
    But we encountered this problem:
    We are able to send input events and trigger the callback but the end value we receive is not the one we sent, and it does not seem to fit calculation we could do with the deadzone (which is the default 0.125 <> 0.925).
    There is also some (0, 0) values being sent that I did not queued.

    Is there something I don't understand, some hidden preprocessor being applied?


    Here is the Log and the project used to produce it, it uses a default playerAction built via the playerInput and the callback is triggered with unity event by the playerInput. I disabled the gamepad and created a virtual one to make sure there is no parasite values.

    Unity version: 2021.3.19f1
    InputSystem version: 1.5.1


    upload_2023-4-26_12-7-15.png
     

    Attached Files:

  2. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    115
    The values do seem consistent with that. Note that deadzoning *renormlizes* in the given range.

    The constant canceling in there I find surprising. Not sure what that is about.
     
  3. IndyNarf

    IndyNarf

    Joined:
    Sep 8, 2015
    Posts:
    7
    I tried doing the math of the deadzone renormalizing and I obtain:
    (0.5 - 0.125) * (0.925 - 0.125) = 0.3
    which is not what I see on the logs :/
    Or maybe I make mistake in computing the projection into the deadzone
     
  4. IndyNarf

    IndyNarf

    Joined:
    Sep 8, 2015
    Posts:
    7
    My bad
    (0.5 - 0.125) / (0.925 - 0.125) = 0.46875
    and it match, the only mystery left is the 0 being sent
     
  5. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    115
    Yeah, that part I'm also puzzled about. Would probably set a breakpoint on the action callback when it's canceled and see what's going on. And check the event trace in the input debugger where there's actual events in there that in fact do reset the control.
     
  6. IndyNarf

    IndyNarf

    Joined:
    Sep 8, 2015
    Posts:
    7
    Maybe it's the mouse moving that force a scheme change, I'll have a look at it today
     
  7. IndyNarf

    IndyNarf

    Joined:
    Sep 8, 2015
    Posts:
    7
    Ok, that's what was happening, using the mouse (or simply hitting the desk too strong making the mouse move) was triggering the control scheme change, canceling all the in progress inputs
     
  8. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    115
    Ah I see :)