Train, Rail and Roller Coaster System

Just figured out how to bake together a track. (dev>MergeActors)
i was at first surprised that the original pieces of track must still be there as a non rendered object

  • the new mesh must have no collision.=> fine.

Now i’m wondering what is the most convenient way to have the baked copy of a complex tracke positioned in the proper position ?
(same as the original parts from which it was baked)

The “most convenient” process i found was to make a copy of all the elements (while rendered) then bake them together and chose the option “replace Source Actors”
But even this way: the new created baked mesh was one world unit to the left and one world unit up compared to pieces of track,
Still it’s easy to reposition the track on the exact spot.

Once done: i select all the pieces of track (the copies) involved in the baking and i set active “Disable Mesh Building”

Is there a better way to do this ? in a way that the baked track would appear just exactly in the same spot as the merged actors ?
I tried playing with option “Pivot point at zero” and selecting the 1st piece of track first but it did not helped in streamlining this baking process.

Streamlining this process can be especially useful when you have to bake and adjust several times your final track.

Any thoughts ?
thanks.

On spline points: You don’t need to use the slow right click menu, you can just drag new spline points off using the standard spline controls.
Check out the official Unreal docs for info on these.

On baking: There’s a built in track baker that solves all this for you. Check out the example terrain track map, or the section in the docs about this which can be found at: Polygon Jelly

If you have any follow up questions after reading that, let me know.
Thanks,
PJ

Hi,

i used the example coaster map and changed the max speed of the speed triggers. But the problem is the speed also changed at some points of the track but there where no speed triggers. Why is that?

Hi again,

Very much got the hang of working with the plug-in now, it’s been incredibly useful, so thank you for that. I have one last question though. My project is VR based, and I have a rideable rollercoaster with a camera, that becomes active when the motion controller pawn/player overlaps with a box trigger. My issue is that by the time the player reaches this point, a significant part of the coaster track is missed. Is there anyway to make it so the train doesn’t begin moving on play, instead starts moving upon the player character overlapping with a box-trigger? I’ve been trying to set it up for a while now, but with no success. Would this involve working with the level blueprint, or the track/coaster cart blueprint?

Thank you

To shorten my question - How would I get the train to run on overlap, as opposed to BeginPlay?

@heimspiel
The speed will change depending on the incline, E.g. it will slow down going up a hill. You can set the coaster to use constant speeds, then use the trigger to set the max speed.

@Adammalvern
Check out the trigger example map, or the trigger blueprints. Here you’ll see how by getting a reference to the train we can apply the brakes or change the speed.
So, you’d have your train on the map, set to stopped. Then add an ordinary trigger and get a reference to that train, then when the trigger is overlapped, release the brakes and set it to moving. You can even set the current speed if it needs to be moving at that speed as the player comes around the corner.

[quote=“PolygonJelly, post:146, topic:87192”]

On spline points: You don’t need to use the slow right click menu, you can just drag new spline points off using the standard spline controls.
Check out the official Unreal docs for info on these.

Could you link to where the docs cover thanks features? Thanks!

[quote=“clone45, post:151, topic:87192”]

For sure, check out these docs; https://docs.unrealengine.com/en-us/Engine/BlueprintSplines/HowTo/EditSplineComponentInEditor
The official docs can be a bit sparse at times, but all the spline controls are pretty much the same, so if you look at a couple of their spline docs you’ll get everything you need.

To add points just hold down alt on a selected point and drag to create a new point. Then just experiments with the point and tangent controls to get the look you are after.

Hope that,
PJ

Got some questions about this… Do this work with world shifting origin ? And do come with a sample that the player can control the train or something on forward and backward and speeds ?

Hello,

Currently i’m fighting with some issue. I want to spawn a mine cart in REAL TIME and attach him to the nearest track and let him go forward, so i wrote some code to achive this.

When i hit “Play”, this things happen:

Any ideas how can i fix this ?

Thanks in advice.

Kind Regards,
Roman

@
Which origin is shifting? Yes, the examples come with speed control.

@Romansky
In your example you’re just setting the attached track and nothing else. Check out the construction script, there are functions that take care of all this logic for you.
The flow needs to be set the track in the carriage and then set it for the bogies, since they are ones that actually move the carriage down the track.

See the ‘Attach to track’ and ‘Refresh positions on track’ functions.
You can use those for exactly what you want, or if you need something more custom, you can make a copy of those functions and update it to your needs.

Hope that, shout if you’ve any more questions.
​​​​​​​PJ

“World Origin Shifting” as said is a engine feature World Composition in Unreal Engine | Unreal Engine 5.3 Documentation just asked if works with.

Another thing, I found you have the same problem I found while tried to make a train back in the time without your pack. On your sample demo, there is a train doing a loop with another one in one of the samples and you can clear see how the wheels move forward and backward because the spline curve error that the engine have by default, that can’t be solved at all without make it on C++ or create a custom system, is even worst if you check it on a huge difference curves or splines with huge difference on distances and the wheels go total off of the train like up 5m off depending of the rail sizes

Hi ,

I haven’t tried the world origin shifting, but I’ll try it out and see if any changes need to be made. I have some new examples and updates I want to get out in the next few weeks, I just need to try and find the time to get to them.

Have you checked out the movement smoothing option? I added it to prevent such spline errors and keep the wheels in a constant location.

Cheers,
PJ

**PolygonJelly

I have a scenario that i want to make sure is possible before I purchase.
Build a train with an engine and 24 cars
I want to able to switch to a different track and leave a cut (a group of cars) on said track.
A second engine comes and picked up the previously cut cars
So I guess I am asking is dynamic parenting is already built in to allow for multiple train scenarios.**

Interesting is there some packaged sample can view the smooth option working ?

@julez4001,
This is possible, the each carriage can have a parent or a child. Usually you’d set this in the editor, but there’s nothing stopping you from doing this dynamically.
There are also track triggers in the system, so for your setup you’d have your train run over the trigger, and disconnect one of the carriages from the parent.
Then you’d have another trigger that reconnects them.
You’ll probably need a custom trigger, but that’s all straight forward.

@
Yep, check out the map: movement_smoothing.umap in the maps folder. It shows two trains, one with smoothing and one without.
It works pretty well and you can tune the smoothing depending on what you want.
You could build far more accurate movement functions for splines in UE, but this works well as a general use case for most peoples needs.

Hi
Building a coaster I have mirrored a portion of the track, is it possible to reverse the connection points on the track sections so I don’t have to re-build the whole thing?

Hello, I am taking your advice to modify the blueprints to fit my application. However, when I make a copy or a duplicate to have as a working copy, the self reference link breaks and it won’t recompile. Any thoughts?

I have been able to make some additions and modifications to the original but if I make a mistake and want to start over, I have to re-download it from the market place and literally start again.

Thanks in advance for any suggestions.

Hey I’m enjoying your package, thanks.
I’m making a HO scale model train game, I’ve managed to scale the trains down and modify settings like the boogie offsets and boogie distances.

It’s working pretty well but I’m having some trouble with the Train Carriages Distance from Parent, it works okay for the first 1-2 carriages, but after 3-4 the distance starts getting screwy. I wonder if there’s some imprecision at this scale?
GIF: Imgur: The magic of the Internet

Do the cars have separate material slots. I would like to add material for the wheels and for the outside of the car.