Experimental Universal Machine Gun Thread (Old title: "Add nodes in real time - is it possible?")

Discussion in 'Programming' started by Agent_Y, Jun 7, 2022.

  1. _N_S_

    _N_S_
    Expand Collapse

    Joined:
    Oct 28, 2017
    Messages:
    49
    obj:setNode() works in real time.

    Example:

    Code:
    local node = {
     cid = #v.data.nodes+1,
     pos = vec3(
      0, --x
      0, --y
      0 --z
     ),
     nodeWeight = 4,
     type = 0, --NORMALTYPE = 0 NODE_FIXED = 1
     frictionCoef = 1,
     slidingFrictionCoef = 1,
     treadCoef = 0.5,
     name = "testNode"..(#v.data.nodes+1),
     selfCollision = true,
     collision = true,
     staticCollision = true,
     nodeMaterial = "|NM_METAL",
    
     getNodeMaterial = function(self)
      local mat,matMap = particles.getMaterialsParticlesTable()
      self.nodeMaterial = particles.getMaterialIDByName(mat, split(self.nodeMaterial,"_")[2])
      return self.nodeMaterial
     end
    }
    
    obj:setNode(node.cid, node.pos.x, node.pos.y, node.pos.z, node.nodeWeight, node.type, node.frictionCoef, node.slidingFrictionCoef, 1.75, 1, 1, 0, 0, 0.5, node.treadCoef, node.name, math.huge, -1, node.selfCollision, node.collision, node.staticCollision, node.getNodeMaterial(node))
    v.data.nodes[node.cid] = node
    
     
    • Like Like x 1
  2. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    Will try this, thanks!
    --- Post updated ---
    IT WORKED! What I was missing was the last line!
    --- Post updated ---
    It crashes the game after using the function more than once and reseting the vehicle, any ideas why?
    And is it possible to delete a node?
    --- Post updated ---
    This is now a thread for the gun mod because it didn't have one before. I added a laser sight with 90m range:
    sashgrt.png
    More progress will be posted later.
    Yeah they are way too small lmao, make them bigger, and would be cool if you added a proper sight model, has to be below the barrel because gravity
     
    • Like Like x 1
  3. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    2,696
    The one you made looks good but i'll do it
    --- Post updated ---
    Presto !
     

    Attached Files:

    • Like Like x 1
  4. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    Nice texture usage, also I made the sight turn on with headlights and adapted Jbeam to the new model. Next I'm adding a dummy, maybe tomorrow.
     
    • Like Like x 1
  5. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    2,696
    Quick fix for the front of the boxy part, it had some small lips where it shouldn't
     

    Attached Files:

  6. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    Added dummy, looks janky but it's funny, only for D-Series since it won't fit on any other car
    sdgstyt.png
     
    • Like Like x 4
  7. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    Bump, repeating original questions so more people see them:
    • How do I add multiple nodes in real time without crashing the game on vehicle reset?
    • Is it possible to delete nodes in real time, if yes then how?
     
  8. maxsaldeezy44

    maxsaldeezy44
    Expand Collapse
    Banned

    Joined:
    Jan 17, 2022
    Messages:
    79
    how get that mod
     
  9. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    2,696
  10. rmfurm

    rmfurm
    Expand Collapse

    Joined:
    Feb 18, 2017
    Messages:
    313
    Bumping here, but the new update added a visualisation for the cannon to see where you are aiming, used for the cannon missions. Could this possibly be adapted to be straight (well it would probably curve slightly, but it would be pretty straight compared to the cannon) instead of curving with gravity, then used on this mod?
     
  11. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    Not needed since we already have a laser sight with way higher range than that. And laser sight is attached below the barrel so it's pretty precise when it's straight even considering gravity.
     
  12. Mikah 01

    Mikah 01
    Expand Collapse

    Joined:
    Jul 25, 2022
    Messages:
    103
    Sorry for bump but i have a suggestion


    When your wip dummy mod will be released , Can you add a sitting dummy to the machine gun ?
     
    #32 Mikah 01, Aug 4, 2022
    Last edited: Aug 4, 2022
    • Agree Agree x 1
  13. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    There is a standing dummy for D-Series gun, sitting would make no sense. Also idk if this update will ever happen since nobody bothered answering my original question for months, I might release a version like in the T-80UD with slightly less lag but not as little as I would like
     
  14. Mikah 01

    Mikah 01
    Expand Collapse

    Joined:
    Jul 25, 2022
    Messages:
    103
    Sitting dummy because i wondered if it could fit on other car
     
  15. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    2,696
    ?
     
  16. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    7,129
    That system still lags when you have like a thousand bullets, I wanted to raise the limit but I can't do it like this
     
    • Like Like x 1
  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