Unsolved Driveshaft between truck and trailer

Discussion in 'Mod Support' started by FilipZaf3312, Aug 25, 2025.

  1. FilipZaf3312

    FilipZaf3312
    Expand Collapse

    Joined:
    Aug 24, 2025
    Messages:
    3
    So, I'm making a mod that adds a PTO output shaft to the MD Series, and a matching trailer with a live axle that I want to connect to that shaft. But when I tried to connect the shaft in JBeam, it didn't work, and I assume this is because powertrain components only work within a single vehicle. Is there a way to make the shafts connect through a node, like electrics, or otherwise connect the shaft through code? My last resort would be to use a rotator on either vehicle and physically connect them, but that would be very inconvenient to use. Any ideas?
     
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,514
    I think the only way is via the rotator. Or you can make the truck and trailer the same vehicle.
     
  3. FilipZaf3312

    FilipZaf3312
    Expand Collapse

    Joined:
    Aug 24, 2025
    Messages:
    3
    I dug around in the source code and yes, the powertrain systems only work on a single vehicle. However, it seems I can easily make a pair of powertrain components and asynchronously connect them via a virtual spring. So the question then becomes how to actually write a system that syncs up the two components? Is this even the right place to ask or should I move this to the Programming forum?
     
    • Like Like x 1
  4. FilipZaf3312

    FilipZaf3312
    Expand Collapse

    Joined:
    Aug 24, 2025
    Messages:
    3
    It turns out it's both much easier and much harder than I expected. I made a powertrain component that takes input torque and sends it through an electrics value, then sets its RPM from another value, with a matching component that does the exact opposite. It works, and having the trailer push the truck is incredibly fun, but there is a massive oscillation in the driveline, which I suspect is from the low update rate of the electrics system. Do electric values only update with updateGFX or can they be made to update at the same rate as the simulation?
     
  5. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,514
    That's the kind of drawback I expected, I don't think there is a way to transmit electric values faster than updateGFX, this is a really difficult problem and it's what made the vanilla implementation of pneumatics sync between the semi truck and trailer so difficult since that had to be done in real time to prevent this kind of issues, and even then it had desync problems that would blow up the engine on the truck or the fifth wheel that took months to fix after the update came out. I suggest looking at how the pneumatics stuff was done because I don't think this is viable with electrics
     
  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