Difference between revisions of "NodeOffset"

Difference between revisions of "NodeOffset"

From BeamNG
(Created page with "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...")
 
m
Line 2: Line 2:
  
 
== Example slots section using nodeOffset ==
 
== Example slots section using nodeOffset ==
Note the use of a [[variable|variables]] for the x axis positioning of the rear wheels.
+
Note the use of a [[variables|variable]] for the x axis positioning of the rear wheels.
 
<source lang="jbeam">
 
<source lang="jbeam">
 
     "slots": [
 
     "slots": [

Revision as of 10:41, 19 December 2015

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", {"nodeOffset":""}],
        ["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", {"nodeOffset":""}],
        ["coilover_R","coilover_R", "Rear Struts", {"nodeOffset":""}],
        ["swaybar_R","swaybar_R", "Rear Sway Bar", {"nodeOffset":""}],
    ],

A peculiarity about nodeOffset that may be fixed in future versions is that it spills into everything after it (and sometimes before it), so it must be reset with a {"nodeOffset":""} in the slots before and after the one being modified.

nodeOffset can be used for many things, but it is primarily used for the new 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. It's also used on the H-Series to make the small flatbed trailer towable.

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.