WIP Beta released Mapper's resource: Functional Train tracks

Discussion in 'Terrains, Levels, Maps' started by bob.blunderton, Jun 24, 2016.

  1. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,289
    OK, here are functional train tracks to integrate into your map for the future train coming to Beamng.drive as a user vehicle mod. The train isn't quite ready for release yet.
    WORKING KNOWLEDGE OF THE IN-GAME TERRAIN EDITOR AND SOME BASIC SCRIPTING REQUIRED.
    These train tracks were sent to me, for a map I am making, by Chris_Lucas on the Beam forums here, thanks Chris. I believe he said to me that these originally came from Rig of Rods universal train system.
    I am including the scripting here so that most anyone can throw these into their map using my examples.
    You'll need notepad++ or something similar to make the scripts like materials.cs show your map dir instead of mine, as I pulled these directly out of my "TN, USA" map. I can't say it's perfect, but they do function.

    DO NOT center origin or use_floor for origin of the object or the collision will be off (when spawning it).

    I learned my scripting at the CPTI (Copy-Paste-er Technical Institute)...

    INCLUDED HERE is a pic of all the stuff laid out for testing purposes. It's not great, and the map it's from is under construction, it is just to give an example.
    EDIT: Use 'VISUAL MESH' for collision. <~~~~ DO NOT FORGET THIS STEP!
     

    Attached Files:

    #1 bob.blunderton, Jun 24, 2016
    Last edited: Sep 16, 2016
    • Like Like x 10
  2. Amtrak America

    Amtrak America
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    590
    Awesome. Thanks. Are there any switches or crossovers?
    --- Post updated ---
    Like this:
     

    Attached Files:

    • image.jpeg
    • image.jpeg
  3. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,289
    Nope, not currently. These would have to rely on additional scripting. Maybe someone could do something like that in the future, with the help of scripting. The script-extender that's been put up for this game would most likely be the biggest enabler, and the 'cat's meow' for where to start.
    There is pretty much anything you need to build simple loops of track, however. You could entirely snag the models out of Rig of Rods universal train systems, Train valley for RoR has a bunch of models, too.
    Admittedly, I only uploaded this for a base for others to start making maps with, I haven't created these models or their textures. I just wanted to make this post (with the permission of Chris_Lucas who passed me these track models), so that ya'all could start making use of them for the upcoming release of the Train mod(s). --Do enjoy!

    Post Scriptum: If someone could possibly script in a switch, and make or port the model for it, it'd be a welcome addition. I make no promise that it'd even work with this game, though.
     
  4. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    thanks!
     
  5. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,289
    Just an addition, you had asked about the use_floor/use_center designations, if you use them, you won't get collision. The origin change (center of model) will knock the collision off. If you did that, you have to go into all the item CS files in the /tracks directory you installed in your map and go ahead and change all the lines that say use_center and use_floor from 1 to 0. Close beam before doing this, and re-open it after it's done. Your models will update automatically. I checked the models before sending them, they were all proper collisions.
     
  6. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    Ok All of the .cs had the option set to 0 yet the collision mesh isnt working.
     
  7. Amtrak America

    Amtrak America
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    590
    Are the tracks deformable?
     
  8. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    no, there static.
     
  9. Amtrak America

    Amtrak America
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    590
    Can a train ride on the if they are static?
     
  10. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    yes they still have colission mesh there just not deformable.
     
  11. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,289
    You may have to exit out of the editor for collision to re-form, also, remove your dupes in your cache/levels/yourmapname dir. Those models get cached everytime the game is run, that's your issue.
    Under the visibility modes panel (the same part that lets you choose wireframe), you can choose the Shape collision, press F11 to toggle out of the editor, and look for the collision model that should basically cover the track object textures in light blue. FPS will drop when using this mode but it'll be useful to see if you've got collision on all pieces or not.
    Deleting the cache out of the directory will fix your problem if your models have that options at 0.
     
  12. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    What would be dupes in cache folder, I removed cache restarted game to avail I'll try a few more things but I feel the file is missing collision, I was doing something in shape editor and got error : could not find col 1
     
    #12 Average Person, Jun 24, 2016
    Last edited: Jun 24, 2016
  13. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,289
    I have collision here; only thing I did was take stuff I was sent, put it in tracks folder in my map, script it in. It's working here; and that zip is merely a copy of that folder. You need to understand TSSTATIC properties of objects in the editor, like setting VISUAL MESH option on collision type, you did do this did you not? Not trying to be mean, but stuff like this is a mappers resource; and I am expecting folks coming in for this to have working knowledge of the editor. This is the same setting you'd use for any type of DAE file imported as a TSSTATIC object, such as buildings or guardrail and the like.
     
  14. coolusername

    coolusername
    Expand Collapse

    Joined:
    Dec 22, 2014
    Messages:
    3,689
    Oh my, who set the switch to this position, the switch blades are right in the middle and a train will derail!:eek::rolleyes:
     
  15. Amtrak America

    Amtrak America
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    590
    That's becuase a track is out of service because they are working in a locomotive on the branch. They do that so a train will derail and grind to a halt, instead of smashing into an out of service locomotive.
     
  16. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    Yes I turned on visual mesh the tracks didnt have blue shading, I understand the level editor but the shape editor keeps giving me this stupid error whenever I attempt to fix collision, i'll give you full error:
    |E| TSShapeConstructor : : GetNodeChild : Could not find node 'Col-1'
     
    #16 Average Person, Jun 25, 2016
    Last edited: Jun 25, 2016
  17. Average Person

    Average Person
    Expand Collapse

    Joined:
    Jul 8, 2015
    Messages:
    583
    Ok I think I figured it out, in the shape editor I was doing some testing turned on visible collsion mesh and cycled through track nodes, there was one, this was the visible part of track but there was not collision node which would explain why there is no collision, Do you know how I would go about creating one?
     
  18. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,289
    I don't know about anything like that bud, your waaaaay overthinking this. Alls I did was some script for the DAE's, add the resource files in (the track units themselves), set it to visible mesh, and voila, had collision 100%. I even checked it with the 'show collision mesh' checkbox in the VIEW MODES panel to ensure that the collision is properly aligned with the model (which it won't be if you do things improperly).
    Why would you goto all that work when you can spawn one of each of the 16 pieces, set them all to visible mesh for collision (individually, doesn't work with group select), then copy from them as you need things. Works fine and dandy that way. Doing more beyond that is searching for fools gold. You could spend that time mapping, actually. Again, not trying to be rude at all here, just wondering why you're going through so much work you don't NEED to.

    To reiterate - to use these models you only have to :
    Add the tracks folder into your map so it looks like "mapname/art/tracks" (this makes editing the next step easier)
    Correct the map entry lines (2 of them), on the materials.cs file in the tracks directory to have your map name,
    add all pieces into your map via the editor (f11 map editor) as objects, you should find them under F1 mode "library > art > tracks" each unit is a different piece. DO NOT
    CAREFUL here as there's 3 similar shorter straight sections, 2 are twisted to account for banking the faster curves (that can get complicated).
    Set every piece's properties individually to Collision Mesh > Visible mesh. (1st picture here is showing the window that pops up when you add a piece to the scene, don't check any boxes unless you KNOW what you're doing or you WON'T get collision if you use_center or use_floormodel). I used another piece as an example for the pic. If you check boxes you'll have to go back and edit the .cs files for each piece individually and set values to 0 & clear your map folder cache manually and restart the game.
    You can now verify collision with the visibility modes box checking shape collision debug and pressing F11 once, it should show up (so will a slight drop in FPS) It should shade the objects blue when you're close enough (2ND, 3RD PIC). Collision won't re-appear until you leave the editor for a moment. When you re-enter the game that's when collision gets recompiled. You always have to cycle out of the editor for a second to refresh collision.
    When you've verified collision is working (Car on tracks,4TH PIC) , you can then go-ahead and start laying track by copy-pasting pieces as needed from your examples you've spawned.

    If you still can not do it, I can not do it for you, I am out of ability to help you.
    --Good luck
     

    Attached Files:

    • 20160625151858_1.jpg
    • 20160625150333_1.jpg
    • 20160625150457_1.jpg
    • 20160625151241_1.jpg
  19. coolusername

    coolusername
    Expand Collapse

    Joined:
    Dec 22, 2014
    Messages:
    3,689
    And why not just change direction?
     
  20. Amtrak America

    Amtrak America
    Expand Collapse

    Joined:
    Oct 13, 2015
    Messages:
    590
    This is when both tracks are in use.
    --- Post updated ---
    Keep in mind that this is very rare.
     
    • 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