NodeOffset

NodeOffset

From BeamNG

nodeOffset is a new feature in 0.5.0.0. It allows you to move a part as it is installed into a slot. It works as a property of a slot, and is defined as a float3.

Example slots section using nodeOffset

Note the use of a variable for the x axis positioning of the rear wheels.

    "slots": [
        ["type", "default", "description"]
        ["brake_R","brake_R", "Rear Brakes"],
        ["wheel_R_4","steelwheel_01a_13x5_R", "Rear Wheels", {"nodeOffset":{"x":"$trackwidth_R", "y":1.25, "z":0.288}}],
        ["wheeldata_R","wheeldata_R", "Rear Wheel Hubs"],
        ["coilover_R","coilover_R", "Rear Struts"],
        ["swaybar_R","swaybar_R", "Rear Sway Bar"],
    ],

nodeOffset can be used for many things, but it is primarily used for the global wheel and tire system. The wheels and tires on their own exist at y:0 and z:0 (x axis varies) and they are placed on the vehicle in the right position with nodeOffset. It can be used to reposition anything, such as the bed and associated parts (the nodeOffset carries through to the children of the part being offset) on the D-Series for the extended cab version.

Another behavior of nodeOffset, designed to work well with wheels, is that it uses absolute values when offsetting on the X axis. So for example, if you have two things, one at x:0.5 and one at x:-0.5, and you offset them by 0.3, they would become 0.8 and -0.8, not 0.8 and -0.2. This keeps things symmetrical and makes it easy to widen or narrow track width. This only applies to the X axis, the Y and Z axis use normal values rather than absolute.

One shortcoming is that nodeOffset cannot be modified, only overwritten. So for example, if you had a suspension part that had a wheel slot with nodeOffset - if you wanted to offset the entire suspension part for a longer wheelbase, you would not be able to correctly offset the wheel slot. The workaround is to duplicate the suspension part and redefine the slots with the correct offset. This way, the only redundant data is whatever nodes and beams are in the suspension part, not any of its sub-components. To see an example of this, look at "pickup_suspension_R_ext.jbeam" in vehicles\common\pickup.