Engine/Differential Glitch

Discussion in 'Content Creation' started by Occam's Razer, Aug 13, 2015.

  1. Occam's Razer

    Occam's Razer
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    1,241
    I've got a vehicle I've been working on for some time, and I've just decided to break it up into multiple .jbeams for part swapping purposes. Part of this is the vehicle's propulsion, which worked just fine prior to the conversion. After, however, the vehicle goes full reverse in neutral faster than the vehicle previously went in drive. Shifting into reverse causes the RPM's to increase slightly above idle, while shifting into drive causes the Tacho to flatline. To make matters worse, an empty fuel tank doesn't stop the vehicle from accelerating. Here's the relevant part of the code:

    Main.jbeam
    Code:
    "enginetorque": [
            ["rpm", "torque"]
            [0, 0],
            [250, 565],
            [500, 1005],
            [750, 1360],
            [1000, 1430],
            [1200, 1480],
            [1500, 1460],
            [1800, 1430],
            [2000, 1390],
            [2200, 1200],
            [4000, 1100],
            [5000, 800],
            [7000, 200],
            [11000, 0],
        ],
        
        "engine": {
            "idleRPM":1000,
            "maxRPM":11000,
            "gears":[-5, 0, 5]
            "burnEfficiency":0.0001,
            "friction":100,
            "fuelCapacity":12,
            "lowShiftDownRPM":200,
            "lowShiftUpRPM":400,
            "highShiftDownRPM":180,
            "highShiftUpRPM":800,
        },
    Propulsion.jbeam
    Code:
    "differentials": [
            ["wheelName1",  "wheelName2", "type", "state", "closedTorque", "engineTorqueCoef"],
            ["LProp","LProp", "lsd", "open", 1, 50]
            ["RProp","RProp", "lsd", "open", 1, 50]
        ],
        
        "rotators": [
            ["name","[group]:","node1:","node2:","nodeS","nodeArm:","wheelDir"],
            
            {"radius":1.0},
            
            {"brakeTorque":0.4},
            {"parkingTorque":0.1},
            
            {"propulsed":1},
            {"axleBeams":["lShaft_1","lShaft_2"]},
            ["LProp", ["lprop"], "lShaft_2", "lShaft_1", 9999, "lShaft_2", -1 {"torqueArm":"lShaft_2"}],
            {"axleBeams":[]},
            {"axleBeams":["rShaft_1","rShaft_2"]},
            ["RProp", ["rprop"], "rShaft_2", "rShaft_1", 9999, "rShaft_2", 1 {"torqueArm":"rShaft_2"}],
            {"axleBeams":[]},
        ],
    I've scoured both files, there are no open or missing brackets. I may be missing something incredibly obvious, as I admittedly don't understand much about engines, torque curves, or the way either real or simulated differentials work. But this code is almost entirely the same code as it was before being split into two documents.
     
  2. Goosah

    Goosah
    Expand Collapse
    Global Moderator
    BeamNG Team

    Joined:
    Aug 30, 2013
    Messages:
    790
    In order for the jbeam to propulse things, the engine and differential code has to be parsed before the wheels. So in your slot heirarchy, you have to make sure that the wheel slot is further down the list of slots than whatever tree contains the differential. What is probably happening is a dummy differential or engine is being added. We found and fixed some drivetrain bugs over the last few days, but since your vehicle worked before, I'm betting on the slot heirarchy thing.
     
  3. Occam's Razer

    Occam's Razer
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    1,241
    Not exactly. The vehicle worked as little as a few hours ago, only becoming nonfunctional upon moving the text over to the slot file. At any rate, I just moved the differential back to the main.jbeam and moved it and the engine above the slot field, leaving the rotators in place in the propulsion file. In spite of this, it is still reversing uncontrollably.

    That said, thank you for the reply, and I will bear your advice in mind.

    edit: Or are you saying that the differential and perhaps engine should be moved to slots of their own?

    edit2: Nope, creating an engine slot containing the engine and/or differential still allows the problem to occur even if they are higher up in the hierarchy.
     
    #3 Occam's Razer, Aug 13, 2015
    Last edited: Aug 13, 2015
  4. Occam's Razer

    Occam's Razer
    Expand Collapse

    Joined:
    Aug 7, 2013
    Messages:
    1,241
    Whelp, I genuinely don't get it. I stuck all the slot-relevant code back into the main file, and it works like a charm again. But I still need swapable parts to feel this project is complete.

    At this point, I have two options:
    • Move the nodes, beams, and triangles to the propulsion.jbeam but leave the engine, differential, and rotators in the main.jbeam. Given what I know, that should fix the issue, but is cheat-y and may result in errors due to the diff and rotators referencing nodes that are in another file, and that may not have been parsed yet.
    • Hand this project over to someone who knows what they're doing to try to fix it. Anyone with noteworthy JBeam experience interested in a beta group (highly unfinished product, not worth a thread yet)?
     
  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