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. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    So you know my machine gun mod. The problem with it is that it gets laggy with several vehicles with guns spawned or with a lot of bullets, because each bullet is a separate node and they all need to be pre-loaded, adding hundreds of extra nodes to the vehicle. I was wondering if it was possible to only add the bullet node as you shoot, then remove it when it lands on the ground and doesn't move for some time. I tried jbeamUtils.addNodeWithOptions() and obj.setNode() but neither of them seem to work in real time. Is it even possible, if yes then how?
    --- Post updated ---
    Ok this is kinda irrelevant now as it wasn't the node count causing the lag but rather the thrusters, I made a simper system without them and no lag now. But still it would be cool to know if you can add nodes in real time.
     
    • Like Like x 2
  2. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    speaking of this mod would you be interested if i tried improving the model ?
     
  3. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    Sure, go ahead if you want, would it be a separate mod or an update?
     
  4. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    An update if you want
     
  5. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    Ok, that would be cool. Would be also an excuse for me to add the improved code and fix some bugs with it.
     
    • Agree Agree x 1
  6. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    There you go ! i didn't UV Unwrap it properly as i couldn't find what texture you used, could you do that ?
    screenshot_2022-06-07_15-40-17.png
     

    Attached Files:

    • Like Like x 1
  7. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    This is a nightmare to unwrap for me as I have little experience, maybe you can do better with this texture as reference
     

    Attached Files:

  8. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    Can you circle what part of this texture you used ?
     
  9. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    parts_offroad_bcolor.png
     
    • Like Like x 1
  10. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    There ya go
    screenshot_2022-06-07_16-51-40.png
     

    Attached Files:

    • Like Like x 2
  11. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    Thanks! I can use it in a mod pack too? I will credit you of course
     
    • Agree Agree x 1
  12. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    Of course, i might upgrade it even more later on but for now it's good enough. Although one little problem is the bearing i put is not exactly in line with the jbeam's pivot point but i'm not sure if you can fix it without messing the jbeam up.
     
    • Like Like x 1
  13. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    I will try to figure it out, thanks!
     
  14. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    Noticed some flipped normals and added a different texture for the handle on the side
    --- Post updated ---
    I've got a few ideas for the mod but i don't know if it's possible,
    • Can the exhaust flame effect be used as a muzzle flash ?
    • Can there be an effect attached to the bullets to be able to see them ?
    • Could a sort of laser sight be possible ? i would do the model of course
     

    Attached Files:

    • Like Like x 2
  15. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    If I knew how to add these, I would have done it long ago. Bullets can't be visible because it would make it too laggy with so many models
     
  16. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    I was thinking about an effect like smoke, but i definitely see why it's not possible. but wouldn't the laser sight be possible with a very long cylinder with emissive materials ?
     
  17. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    I can try for the update but not sure if it will work, the game sometimes doesn't like too long models
     
    • Like Like x 1
  18. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    Even if it's not very long it would be better than nothing i think.
    --- Post updated ---
    I got an idea; since i added handles at the rear, could a dummy be put here ?
     
  19. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,058
    Maybe for the D-Series it could, the issue I have with dummies though is that I put them in so many of my mods and they all have different models, textures and materials, it's hard to make it all compatible together, but I can add it here
     
    • Like Like x 1
  20. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,098
    Cool !
    I also thought about the sunburst, it might be possible to do if you remove the trunk
    Also the handles are very probably too small i'll make them bigger
     
  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