No announcement yet.

analog joystick/gamepad input, small but annoying log-bug

  • Filter
  • Time
  • Show
Clear All
new posts

    analog joystick/gamepad input, small but annoying log-bug

    [post edited, September 10, 2007] Problem fixed, see below.

    Yow. My 1st post

    I'm trying to map the two joysticks of my gamepad to some float variables so I can use them to control stuff the fancy way. However, the Interactions do not seem to react to axis input, so I stepped away from the KeyEvent(...) method and went looking in the user.ini and changed some stuff:

    JoyX=Axis Axis1H SpeedBase=5.0 DeadZone=0.1
    JoyY=Axis Axis1V SpeedBase=5.0 DeadZone=0.1
    JoyZ=Axis Axis2H SpeedBase=5.0 DeadZone=0.1
    JoyV=Axis Axis2V SpeedBase=5.0 DeadZone=0.1

    Changed the variables from aBaseY, aStrafe, etc, to a new set of variables (Axis1H, etc) so that I would have the analog input, but not the viewrotation. These new variables are declared in my new controllerclass (LeanderPlayer) as "var input float Axis1H, Axis1V, Axis2H, Axis2V;". Everything works fine, controlling two camera's at a time and stuff.

    But now comes the problem... When I end the game and switch back to the main menu the log starts to overflow with "Log: SpeedBase=5.0 DeadZone=0.1 Speed=0.000000 Bad Axis command", the same error as when using a non-existing variable. One error log for every tick till I quit UT, disable joystickinput, disconnect the joystick, or start a game with my gametype so it can access LeanderPlayer again.
    The problem is obvious: the new variables are declared in a class that is not active in everything except my custom gametype and a joystick never stops sending data.

    Now for the solution... I've tried some workarounds, like "ConsoleCommand("set ini:Engine.Engine.ViewportManager UseJoystick true")" when starting the controller. It works, but I can't find out when to switch it back to false. Putting it in the controller's "event Destroyed" doesn't work. So what else can I try? I just need to get rid of those logs...


    *btw, my unreal puppet DOES have legs


    Ok, I just found a nice workaround: The variables epic uses for movement control are "aBaseX, aBaseY, aBaseZ, aMouseX, aMouseY, aForward, aTurn, aStrafe, aUp, aLookUp". The variables aBaseX, aBaseZ, aTurn and aLookUp are not really used. That is, they are used, but not in the common mouse-keyboard controls, so I can live without them. Good thing is, these variables don't give those annoying log entries. Here's what I did:

    - In the user.ini, the joystick lines look like this now:

    JoyX=Axis aBaseX SpeedBase=5.0 DeadZone=0.1
    JoyY=Axis aBaseZ SpeedBase=5.0 DeadZone=0.1 invert=-1
    JoyZ=Axis aTurn SpeedBase=5.0 DeadZone=0.1
    JoyV=Axis aLookUp SpeedBase=5.0 DeadZone=0.1 invert=-1

    - In the PlayerController's PlayerTick event the variables are handled like this:

    Axis1H = aBaseX; <-assign joystick variables to my own floats.
    Axis1V = aBaseZ;
    Axis2H = aTurn;
    Axis2V = aLookUp;

    aBaseX = 0; <-reset the original to '0' so the screen/pawn movement won't be affected.
    aBaseZ = 0;
    aTurn = 0;
    aLookUp = 0;

    ok now you got me started

    i installed my xbox 360 pad on my pc you can get the drivers from microsoft

    i got the movement working fine thanks for your post

    I added this to my user.ini

    JoyX=Axis aTurn SpeedBase=50.0 DeadZone=0.1
    JoyY=Axis aBaseY SpeedBase=300.0 DeadZone=0.1 invert=-1
    JoyR=Axis aStrafe SpeedBase=300 DeadZone=0.1
    JoyU=Axis aLookUp SpeedBase=50.0 DeadZone=0.1 invert=-1

    trouble is no matter where i put fire and alt fire i cant get them work on the LT & RT buttons on the pad any surgestions?


      I've got fire and alt-fire on button 5 and 6 (the two left and right at the index-finger), both are working fine... If it doesn't work through the input menu, try binding the buttons in the User.ini. Otherwise check if 'Use Joystick' is enabled in the input menu.


      There shouldn't be any problem...