Hello,
I am making a character (in my case a Train) follow a spline path.
Character is using character movement.
To make my Train move I every tick apply Node “Add Movement Input” where direction is actor forward vector, and every tick a Set Character Movement “Max Acceleration” according to my math formula. That makes train to move forward and follow railroad (spline).
Problem: When railroad turns, I calculate new rotation of spline and apply it to Train rotation, so Train would turn to direction of railroad. This also change a forward vector so Train now accelerate in new direction. Problem is that this new direction doesn’t override current train momentum. Train will try to turn to railroad direction, but current momentum make that train to overshoot a turn.
Do you have any advice how to make Train to follow a railroad without overshooting turns?
Hey @Bear_Investor how are you doing?
Probably the best approach to avoid that issue is to directly override the train’s velocity instead of fighting against momentum!
To do that, you can do something like this:
That should make your Train move following the railroad without overshooting any turn.
Let me know if it worked or if you need more help!
Thank you @BRGJuanCruzMK. Your solution worked. I implemented your advice with some modification to my code, and now Train follow railroad.
For anyone else who might have the same problem and this solution might not worked properly:
In my case, I calculate Spline Direction from actor “forwar vector”, because my logic to turn Train is more complicated. So I add to my code only the part where you set “velocity” for “Character Movement” component by multiplying “Spline Direction” with “Current Speed” and that solved my problem.
Hope this will help anyone who also trying to make Train in their game 
Thanks again @BRGJuanCruzMK 
1 Like