Unsolved Releasing Grabbed Nodes

Discussion in 'Mod Support' started by HighBeam9000, May 8, 2022.

  1. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Hello!

    I'm trying to programmatically release nodes that were stuck together with the node grabber. For example, if I strap a mattress or recliner to the top of a car using the node grabber, I'm trying to dump the cargo with the push of a button. Here's the code of interest:

    Code:
    --Prep the module
    local M = {}
    M.type = "auxilliary"
    M.relevantDevice = nil
    M.defaultOrder = 1
    
    --Release node-grabbed nodes
    local function releaseNodes()
      
        --Get player vehicle ID
        local vid = be:getPlayerVehicleID(0)
        if vid ~= nil then
          
            --Release node-grabbed nodes
            be.nodeGrabber:clearVehicleFixedNodes(vid)
            log('I', "Node Release", "OK...")
        else
            log('I', "Node Release", "Uh-oh...")
        end
    end
    
    -- Public interface
    M.releaseNodes = releaseNodes
    
    -- Return the module
    return M
    I've progressed to the point where no errors or warnings pop up in the debug window, and I can see where "OK..." is output because the code reaches that point, but nothing seems to happen. The above code is in an "extension.lua" file, which is loaded with a "modScript.lua" file.

    I think I read in another post that the function be.nodeGrabber:clearVehicleFixedNodes unsticks any nodes stuck to a vehicle using the node grabber. Am I using the function wrong, or maybe using the wrong function?

    I'm actually testing this by spawning the D-series tow truck mod, using the node grabber to stick the tow hook to the front bumper of a Pidgeon, and towing it away. When I get to the scrapyard, I trigger the code above, and I see "OK..." appear in the debug window, but the tow hook doesn't detach from the Pidgeon's bumper.

    Any help that can be provided is greatly appreciated.

    Thank you.


    P.S. -- I posted this in the wrong area earlier. Sorry for the extra post.
     
  2. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    I believe this function was fixed in the 0.25 update, let me know if otherwise.
     
  3. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Sweeeeeeet! I'll give it a try. Thank you!
     
  4. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    I tried the function again, and it releases grabbed nodes that are stuck in mid air, but it doesn't seem to release nodes that are stuck to other nodes.

    Nodes-to-Nodes
    For testing, I spawned the D-Series tow truck again, and tried to tow a Covet. I stuck the tow hook to the Covet's front bumper using the node grabber and towed it away. When I got to the repair shop, I tried to release the tow hook from the bumper using the code listed above. I saw the "OK..." message in the debug console, but the tow hook didn't release the Covet bumper. I also noticed that I couldn't manually release the nodes using the middle mouse button.

    Nodes in Air
    I remembered being able to manually release nodes using the middle mouse button when I hung them in mid air. I verified this by resetting the tow truck, hanging its hook in mid air, and releasing the hook with the middle button. I then hung the hook in mid air again, and successfully released it using the node release code above.

    Maybe there's a subtle difference between nodes hung in mid air vs. nodes stuck to other nodes?
     
  5. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Actually unfortunately that function was just meant to release nodes fixed in the air. I'm afraid there isn't a solution at the moment :/
     
  6. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    With nodes stuck to each other it's better to use couplers than node grabber
     
    • Like Like x 1
  7. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Doh, I was afraid of that. Thanks for checking it out.

    I still have a question though: Is there a way that I can use the mouse to unstick nodes stuck to other nodes using the node grabber? I can use the middle mouse button to unstick nodes hung in mid-air, but that doesn't seem to work with nodes stuck to other nodes. I'm probably doing it wrong.

    I had the tow truck in mind, which has a coupler on the hook, but not all vehicles have a corresponding coupler on a bumper. For most cars, I have to stick the hook to the bumper with the node grabber. I was hoping for a convenient function that drops all grabbed nodes on-command. I have a work around that involves a small octahedron (breakable link) that's inserted between the tow hook and the towed vehicle's bumper. On-command, the octahedron breaks all of its beams, releasing the car being towed.
     
  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