Download

Developing a Roller Coaster System

I’ve started working on a roller coaster system for moving objects along tracks. I know that there are already a few solutions out there, but I think my approach is quite different.
First of all, it does not use splines. My goal was to create something that feels like RCT, where you snap different pieces of tracks together.
As I said, I don’t use splines, instead there are different Blueprints for different shapes of tracks. Each of these Track-BPs implements a different equation for the track curve. Currently there are

  • Straight
  • Circle
  • Clothoid

By snapping together these Track-BPs, you can create 3D curves with an exact mathematical representation. Of course, direction and radius of curvature will match automatically at the location where two tracks are snapped together. Tracks snap together automatically, when dragged into the level from the content browser.

The shape of a track can be modified by dragging the widget at the end of the track. This even works if the track is connected at both ends. Check it out:

The cart is another blueprint, it will find the first piece of tracks and snap to it. It does not use the UE4 physics system, but a simple set of equations to determine the speed.

Using this system, it is possible to create very comfortable roller coasters where the radius of curvature is not changing abruptly at the start/end of curves.

Here is an explanation of the different types of tracks used to make the roller coaster in the video:

tracks explanation.jpg

How does it work internally? The cart is really driving on the tracks. This means that the Cart-BP knows which is the current Track-BP, and each frame it calls a function on the Track-BP to calculate the new cart position given the current cart speed. If the end of a track is reached, the Track-BP will return a reference to the new piece of track that is connected to the Cart-BP.

I’ve been asked if I want to make the Roller Coaster System available to the community. The answer is yes, but I have not yet decided in which form.
At the moment, it is basically a proof of concept and not a finished system. Also, I’ve developed this some time ago in 4.7, and the Blueprints have since then managed to corrupt themselves, meaning that the engine crashes when I try to compile the blueprints. I suspect it has something to do with the fact that a set of connected tracks is basically a doubly linked list, which can easily lead to memory leaks or infinite loops if something goes wrong. I also make heavy use of inheritance, overriding functions and pure functions, for example the circle Track inherits from the straight Track, it just has a function override for the function that gives the track shape with a circle equation instead of a line equation.
At the moment, I’m creating everything again in 4.10 from scratch because I don’t want to convert the corrupted Blueprints from the old project.

This is a very interesting concept, I do recommend some thing that will wrap around the rails instead of going through though, and it will effect how smooth it will br so spend some time working on them.
Overall, good job!

Thank you,
Articuno032

I don’t think I understand what you mean exactly. At the moment I just draw a debug line where the center curve of the track is. I may use procedural mesh generation to create the mesh of the two rails in the future, or maybe I will use a mesh deformed by a spline.

Ohhhh, OK, splining is very good in some situations, especially for this.

Very cool!
it would be great to see some blueprint screenshots!

I am interested. Is it still in development?

I’ve paused development of this while I was busy releasing Physical Water Surface. But I want to make this the next product I release on the Marketplace. Maybe I can make some progress with this over the Christmas break. The best think you can to is to subscribe to this thread, I will post here if there are any updates! Thanks for your interest!