Rollercoaster Problem: Bones following Curve
I managed to find a solution, but it's a bit of a hack. Most notably, the process involves baking the animation, so it needs to be redone every time you want to change the layout of the curve.


select every bone in the chain and make sure "Inherit Rotation" is turned OFF
keyframe your "helper" IK curve to whatever you want the train to do (I wanted mine to go full circle around the curve)
Add a cube or empty somewhere high up in the scene (doesn't matter what it is)
make a copy of the armature/mesh in case we want to go back
bake action (visual keying and clear constraints)
select every bone and add a locked track constraint to each one, targeting the cube or empty or whatever you added in step 3. Fiddle with the settings until it makes your train stay upright.
bake again and export for use in Unity or other game engine.


Simple, right? Repeat steps 5-7 every time you change the curve or otherwise modify the setup. I'd much prefer adding the locked track constraints without baking in step 5 to avoid this, but I simply cannot get that to work, the Spline IK constraint overrides my Y axis rotation. So this will have to do. If anyone has a better way to do this I'd be very much interested.