I am attempting to have a moving train along track, which is moved via Body Velocity. To direct the train along the track I use ball gliders, which sit on the “ballast”, inbetween the rails, as shown below:
The issue is that when moving from one ballast part or rail part to another, the gliders like to jump. Even at low speeds. This causes the trains to come off the tracks and derail. I believe this has something to do with PGS and the way it reacts to moving across one parts surface to another, or the way it reacts when hitting those parts. To demonstrate this I have colour coded the different ballast parts here:
This gif from one of my fellow developers who uses exactly the same system shows the train jumping so badly it comes off the rails:
I have tried using other methods of moving the train, such as VectorForce, BodyForce, this still happens. I’ve also tried messing around with the weight of the train, it can be heavy or light, still no luck. Making the gliders heavy and the rest of the train light also does not resolve this.
This jumping can still occur even if there is no brickshift or no gaps inbetween the two parts its moving over. This jumping issue is even worse when using Square or Cylinder gliders, but I believe this is due to their shape. Ball gliders, being round, will be effected by this the least.
Does anyone have any extra solutions or suggestions to prevent this?
As one who also develops train games, this also occurs in my game on curves with large sums of parts like ‘ballast parts’ and the rails themselves. The current version my game is running on has a grid-like track layout because tracks were placed manually and lazily, not generated with a plugin. Because of this, the jumping is not as frequent on straights, but again, happens often on curved sections.
My temporary solution was to increase the workspace’s gravity. This required experimenting with trial and error, but if you set it high enough, it manages to eliminate or hide most of the obvious jumping around. I say this is a temporary solution because the ‘remastered’ version we have in development is very curvy and windy thanks to a private track generation plugin we use and we have noticed this exact same problem occur all too frequently in it.
If not tried already, consider changing the custom properties of your ‘glider parts’ (those two grey balls you have, for example) and setting the elasticity to 0. Other than that, you can experiment with other systems like using CFrame instead of BodyMovers.
What I personally would do is add actual suspension to reduce the impact the wheels have on the body, in addition to this id also decrease the workspace gravity, allowing the parts to not collide as much and it causes everything to act smoother and slower.
I attempted adding suspension, it sadly didn’t really remove the issue. Decreasing the gravity made the trains more liable to jump. Adding more to the gravity did make the jumping less critical at times…but it also, with it being stronger, was like the trains were being downforced onto the tracks. Sounds like a good thing however, when they jump majorly, it causes the whole train to start spazzing out.
As I said in my main message, using cylinders as gliders gives worse results.
Adding an invisible track above has helped remove problems in some ways, but has also added problems. They made the train spaz up and down when it ‘jumps’ and also can make the trains get stuck at certain points, such as where track tilts on bends or going up slopes.
You could connect the train to invisible blocks above that tween the places you want it to go if you really want a smooth ride. Make the train no collide to the track
Solutions like that along with CFraming the trains movements have been on my mind. My only concern is that moving them like that would cause strain on the server / client, especially if theres loads of moving trains at once.