Yeah, I see what you mean. Someone was asking about movement of the train along the spline about a year ago on the forum. At the point I thought about geometrical solution, this was the illustration:
The whole idea was about finding two points on the spline where bogies will be at some point in time. For example you can integrate position of the first bogie and then find a second one as intersection point of the spline and circle with diameter of distance between bogies. It’s doable but I didn’t do the math for it.
What you suggest is to place a physics constraint on each bogie, connecting them to the train, so that they can rotate to some degree but stay connected to the train. Then on each step estimate where bogie will be on the track in t+1 time and apply a “correction” force sideways, which will push bogie and subsequently wheels back to the “proper” path. Some torque would be necessary to rotate bogies along the spline too.
I mean this is really the choice of solving it as kinematic system or physics system. In kinematic we have to calculate position, rotation and velocity for each element, which is doable geometrically but won’t allow much of physics interaction with the rest of the objects in level. I would prefer physics one, just not sure where one would start from. Wheels can be driven along the spline by a simple spring system, which should be enough to align them along Y axis of the track. But in curves, wheel on one needs to have a smaller speed than wheel on the other side (just as in cars and this is why we have differential). Difference is speed on side will lead to a specific angle of the bogie. Or we have to calculate angle of the bogie in one way and alignment of the wheels along Y axis of the rail separately.