1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.35 Bug Reporting thread
    Solutions and more information may already be available.

Joystick configuration for (Accel&Brake) in same Axis

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by FasTsIrK, Aug 29, 2013.

  1. FasTsIrK

    FasTsIrK
    Expand Collapse

    Joined:
    Aug 18, 2013
    Messages:
    7
    Hi, i have this controller:

    la foto.JPG

    I want to use the same axis to Accelerate and Brake but i cant get any way to configure it. Is it possible?

    I put my configuration here:

    Code:
    // Product Name: USB  Joystick
    // GUID: {00130E8F-0000-0000-0000-504944564944}
    // axes: 2^X^Y
     
    //%device = "{00130E8F-0000-0000-0000-504944564944}-" @ %joyNum;
    %device = "joystick" @ %joyNum;
     
    // 0 deadzone
    $gp_deadzone = "-0.15 0.015";
    
    // movement
    moveMap.bind(%device, xaxis, steer);
    moveMap.bind(%device, yaxis, brake);
    moveMap.bind(%device, yaxis, "ID", $gp_deadzone, accelerate);
    
    With this configuration only can accelerate, but if i put the brake line after accelerate i only can brake.

    Thank you!
     
  2. TacoTormentor

    TacoTormentor
    Expand Collapse

    Joined:
    Aug 27, 2013
    Messages:
    9
    The input map for the Hitec Aurora 9 R/C (0030000.inputmap.cs) uses just "joy_accelerate" for the y-axis. However, when I use it with my older styled Logitech Driving Force wheel (same axis for accel and brake) it just spams the console with "joy_accelerate: Unknown command.". A bug, perhaps?
     
  3. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,074
    joy_* is not existing anymore. Please have a look at scripts/client/beamng.cs to see the new functions.

    joy_accelerate was replaced with "accelerate"
     
  4. FasTsIrK

    FasTsIrK
    Expand Collapse

    Joined:
    Aug 18, 2013
    Messages:
    7
    Thank you for replies, i will take a look to the scripts/client/beamng.cs file.

    Could be solved with definition of diferent deadzones for accel and braking in the same axis?
     
  5. FasTsIrK

    FasTsIrK
    Expand Collapse

    Joined:
    Aug 18, 2013
    Messages:
    7
    Somebody could help me with this?, i think that is neccesary a function to use the same axis to acelerate and brake, the same as the steer.
     
  6. FasTsIrK

    FasTsIrK
    Expand Collapse

    Joined:
    Aug 18, 2013
    Messages:
    7
    Could anybody help me with this?

    I have configured the G27 and works fine, but i cant make works accel and brake in the same axis in this device.
     
  7. Kamil_

    Kamil_
    Expand Collapse

    Joined:
    Mar 17, 2013
    Messages:
    691
    Hey

    Try this:
    Code:
    function two_axis(%y)
    {
        if(%y>0)
        {
             accelerate(%y);
        }
        else
        {
             brake(-%y);
         }
    }
    [COLOR=#666666]moveMap.bind(%device, yaxis, "ID", $gp_deadzone, two_axis);[/COLOR]
     
  8. FasTsIrK

    FasTsIrK
    Expand Collapse

    Joined:
    Aug 18, 2013
    Messages:
    7
    Hi, thanks for helping,

    i added the function to beamng.cs but nothing happens, i modified the code as this and worked:

    Code:
    function two_axis(%val)
        {
        if(%val>0)
        {
             vlua("input.event(\'axisy1\', " @ %val @ ", 2)");
        }
        else
        {
             vlua("input.event(\'axisy0\', " @ %val @ ", 2)");
        }
    }
    
    but always enter in the first sentence, val is always bigger than 0. Im trying to show the console in the game, but i cant find the key, whats the key to show the console, and how can i see the value of the variable that is giving the axis?

    if in the first sentence put the brake_direct function, works fine, but if i put the accel_direct the axis works in wrong direcction. When i go to brake, the car accelerate.

    thank you!
     
  9. Kamil_

    Kamil_
    Expand Collapse

    Joined:
    Mar 17, 2013
    Messages:
    691
    press k twice(i think, maybe just once) untill you see the input debug screen, there you will be able to see the axes and buttons on the controller.

    Also something I didn't know about:
     
    #9 Kamil_, Sep 5, 2013
    Last edited: Sep 5, 2013
  10. TexanMiror

    TexanMiror
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1
    I made my Sidewinder Force Feedback 2 Joystick working with this function and it is working perfectly - but make sure you do not use automatic transmission! At least for me, it did weird things (always accelerating in reverse or forward).
    Use q to switch to manual or manual with auto clutch and map two buttons to switch up and down gears or use the x and y keyboard commands.
     
  11. FasTsIrK

    FasTsIrK
    Expand Collapse

    Joined:
    Aug 18, 2013
    Messages:
    7
    Re: Joystick configuration for (Accel&Brake) in same Axis

    Hey!, i did it :D Thanks to the debug mode. I only must invert the value and worked:

    Captura de pantalla (2).jpg

    Code:
    function two_axis(%val)
        {
        if(%val>0)
        {
            vlua("input.event(\'axisy1\', " @ %val @ ", 2)");
        }
        else
        {
            %val=(%val*(-1));
            vlua("input.event(\'axisy0\', " @ %val @ ", 2)");
        }
    }
    
    Thank you for help.

    - - - Updated - - -

    I attach the 2 files that i moddified and use
     

    Attached Files:

    #11 FasTsIrK, Sep 6, 2013
    Last edited: Sep 6, 2013
  12. mamham

    mamham
    Expand Collapse

    Joined:
    Oct 17, 2014
    Messages:
    3
    In case this helps someone.

    The above code did work for me but with a slight bug. The bug is that when I move a controller axis quickly from non-neutral to neutral, the game does not fully reset the corresponding input value to zero. I fixed this as follows:


    Code:
    function two_axis(%y)
    {
        if(%y>=0)
        {
             accelerate(%y);
        }
        if (%y<=0)
        {
             brake(-%y);
        }
    }
    moveMap.bind(%device, yaxis, "ID", $gp_deadzone, two_axis);
    Not sure why this works better, but it does.

    Just thought I'd share.

    Cheers.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice