Unsolved Find IDs of the beams attached to a specific node through lua

Discussion in 'Mod Support' started by Preston Elam, May 2, 2020.

  1. Preston Elam

    Preston Elam
    Expand Collapse

    Joined:
    Apr 8, 2017
    Messages:
    16
    So, in short, I have the IDs of all of the nodes I need. I however, can't find the IDs of their respective beams, I don't know how to do this.

    In context, I am working on a tire wear mod, part of this mod involves being able to change tires and such without resetting the damage of the car, I plan to do this by utilizing the save/load methods of beamstate, I want to add a "middle-man" of sorts to reset the values of just the tires the I have the IDs of all of the nodes related to the tires, but, I can't find the beams for said tires. I need to be able to change the 'fix' (change the 'broken' value to false) the beams, but as before mentioned, I can't find them.
     
  2. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Engineering
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,670
    Hey,

    in order to find beams attached to a given node, you need to iterate over all beams (in v.data.beams) and check their id1 and id2 properties. These are nodeIDs, so if any of the two matches your given nodeID, the beam is connected to that node.
     
  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