Custom PressureWheel?

Discussion in 'Programming' started by mjc506, Nov 29, 2018.

  1. mjc506

    mjc506
    Expand Collapse

    Joined:
    Oct 13, 2013
    Messages:
    13
    Is it possible to 'adjust' the algorithm used to generate pressure wheels, or to 'hard code' a wheel into a jbeam?

    I'm trying to make different shaped tyres - at the moment, a rounded cross section, but I imagine the work would be useful for wide/soft tyres that need to deform more.

    It would be straight forward, if a little tedious, to build a wheel in a jbeam file, but how would that then be connected to the standard transmission (as the output of a shaft or diff etc, as with a 'normal' wheel)?

    A 'better' solution would be to alter the algorithm used by the standard PressureWheels, for example to add in a parameter to control how many nodes should be generated 'across' the tread, one for 'shape' (0 for a square tyre, +1 for semicircular convex, -1 for concave perhaps?)
     
  2. estama

    estama
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 7, 2012
    Messages:
    267
    The "algorithm" or code that creates the wheels is open and you can look at it in lua\vehicle\jbeam\jbeam_wheels.lua

    If you want to "precook" a wheel inside a jbeam structure then you can drive it using a rotator (this is for example what airplane propellers use).
     
    • Informative Informative x 2
  3. mjc506

    mjc506
    Expand Collapse

    Joined:
    Oct 13, 2013
    Messages:
    13
    Thanks,

    Can I override that .lua for a specific vehicle (what should the directory structure of the mod look like?)

    I suspect using that lua script is 'better', as it registers the wheel(s) with the game engine, and lets the powertrain, speedo etc work properly?

    Otherwise, can that lua be inlined in the vehicle lua (on spawn or reset)? I can't work out how inlining the lua or overriding the stock file will play nicely with other vehicles, if it even works at all. Unless I create a 'new' wheel? (copy PressureWheel and edit/rename it) How would I get the jbeam to call the new code in that case?


    In the case of a baked wheel and rotator, how do I direct a shaft to output to the rotator (instead of wheel_rl for example)?
     
  4. mjc506

    mjc506
    Expand Collapse

    Joined:
    Oct 13, 2013
    Messages:
    13
    Ok, still struggling :-(

    I can get rotators working with shafts (just set the output of the shsha as the rotator name), but can't seem to get it recognised as a 'wheel' with brakes, abs, damage ui etc. Is there a way of doing this?

    I'm trying to follow from main.lua how the game engine normal sets up pressureWheels, but I'm getting lost. How should I add lua into my vehicle that generated wheels that the game engine recognises, but with the additional nodes/beams that I want?

    edit: I should clarify: How do I set up the lua so that it affects my vehicles, but not other vehicles?
     
    #4 mjc506, Jan 13, 2019
    Last edited: Jan 14, 2019
  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