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.

Controll Differential with LUA

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by marco0020, May 31, 2022.

  1. marco0020

    marco0020
    Expand Collapse

    Joined:
    Aug 11, 2018
    Messages:
    31
    Hi. i'm developing a tank. To steer, it brakes the left or the right rotator but it is very undrivable because you can loose control of it even if you are at 6 Mph. To solve the problem i used a lockable differential but if the differential is locked you can not steer. i would like to write a script with LUA that once captured an input from user, it unlocks the differential that is normally locked.
    How can i do it?
     
  2. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    2,056
    You can use "differentialTank.lua"(powertrain device) and tankDiffCtrl.lua(control logic) in this mod
     
  3. marco0020

    marco0020
    Expand Collapse

    Joined:
    Aug 11, 2018
    Messages:
    31
    Thank you but you found exactly the mod that i'm renewing .
    I'm editing It and i want to change that steering logic because it is not very effective
     
  4. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    2,056
    Does my improved steering still ineffective?
     
  5. marco0020

    marco0020
    Expand Collapse

    Joined:
    Aug 11, 2018
    Messages:
    31
    No. I noticed that i had to edit a value.
    I reduced the brake torque when braking because it was not realistic but i forgot to increase the brake torque when steering. Thank you for help.
    Now i just need to increase grip but the page of the wiki that explains how to use rotators returns 404 so i don't know how to do it
     
  6. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    2,056
    My steering modification disabled the use of brakes to steer, brake is only used for deceleration
     
  7. marco0020

    marco0020
    Expand Collapse

    Joined:
    Aug 11, 2018
    Messages:
    31
    Ok than i edited a value that makes it work correctly. The first rule of programming: if it works, don't touch it xD.
    Anyways, do you know how to increase grip of the rotators? I edited the gear ratios and the torque and now it tends to oversteer
     
  8. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    2,056
    Increasing the grip of tracks in BeamNG doesn't prevent oversteer, since track segments rotate, you cannot increase the rear friction of the track while decrease the friction at front of the track. Tracks in BeamNG are like segmented tires, which have a critical sliding angle. When the vehicle is sliding too much, tire's grip will reduce, similar to the stall phenomenon on aircrafts. In cars you can countersteer, making the front wheels' pointing the vehicle speed vector to regain grip, but you can't do that on tanks. During high speed turns, the angular velocity decreases the front sliding angle while increasing the rear sliding angle, thus the tracks' rear segments will lose grip first, causing oversteer. This is not realistic (BeamNG's simulation is less accurate in tracked vehicle) as tracks are made by metal, they don't "grip" the ground, thus no critical slide angle.

    Thus, in the steering update, I tuned the tank diff logic deliberately to make the tank just short of oversteer threshold during turns, that's why the higher the gear, the more sluggish the turning speed.
     
  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