Keiji wrote:That shouldn't be possible, so long as a convention for driving direction is established.
Take the shadow of a dual carriageway (divided highway) like I described - the rails are two parallel planes split down the middle, into four.
The cross-section of this as one moves in the direction of traffic is then four lines like so
==== ====
We can assign a coloring to this, say, the top rails are red, and the bottom rails are blue. Let us also say that vehicles drive "into" the screen on the left carriageway as it appears here, and "out of" the screen on the right carriageway. If we look at it from the other direction, the top rails are blue, so we know the vehicles driving "into" the screen must be on the right instead. Similarly, if we rotate 180 degrees in the plane of the screen, the same thing happens. So we can establish that if the red rails are on top, vehicles driving "into the screen" are on the left.
What we now do is we make sure that all roads have a red rail and a blue rail in a similar way, and that red rails only ever join to red rails and blue rails only ever join to blue rails. This establishes a chiral property for left- or right- handed driving, and ensures that vehicles cannot get flipped around.
The problem with this is that there is no fixed "top" and "bottom" rail, because in 4D, they lie on the lateral dimensions, which can rotate arbitrarily. For simplicity, let's take a rectangular section of a red/blue rail pair. So these are two rectangles lying on parallel 2D planes, which, in turn, lie on some 3D section of the ground. To make this more precise, let's say W is the vertical dimension, which means the ground spans the X, Y and Z directions. Say the rail pair stretches from -X to +X, and they are separated in the Y direction: say, the red rail lies in the +Y direction, and the blue rail lies in the -Y direction. So then the width of the rails lie in the Z direction. Now let's say we're standing at one end of the rail pair, say at the -X direction, and we're looking down the rails in the +X direction. Since up is +W, that still leaves a single degree of freedom in orientation (rotation in the YZ plane).
Consider the case where we're oriented such that our +Y and +Z laterals line up with the +Y and +Z dimensions of the ground. So then we see the red rail in the +Y direction, and the blue rail in the -Y direction. Let's say we decide on the rule that when red lies in the +Y direction and blue lies in the -Y direction, then vehicles will travel in the +X direction.
Now remember, since we have one degree of freedom in our lateral orientation, we can rotate about the YZ plane. Suppose we rotate 180° while standing on the same spot and facing the same direction. Then, from our POV, +Y rotates to -Y, and -Y rotates to +Y, but +X remains unchanged (since it lies in the stationary space of the YZ rotation). So now we see the red rail in the -Y direction (relative to ourselves) and the blue rail in the +Y direction, and we conclude, from our rule, that vehicles should travel in the -X direction.
Contradiction.
Now consider the following 3D diagram of some roads around a 3D city block:

I didn't have time to add everything I wanted to add in this diagram (modelling curved shapes in povray is very tedious), but let's imagine that there are ramps that allow cars to transfer between the lanes.
Let's say we start at the bottom of the left face on the red lane, moving up (in the 3D projection, that is, not up in the 4D sense). Let's say we turn onto the red lane on the right face. The easiest way to build the ramp would be to first allow a 90° right turn on the left face, then a 90° turn from the left face to the right face, which then lets you merge into the red lane on the right face.
Suppose now we want to merge onto the red lane on the top face. The simplest way to do this is to have a branch on the red lane on the right face, that turns 90° to the left, then 90° from the right face to the top face. This then aligns our orientation so that we can merge onto the red lane on the top face.
Lastly, suppose we merge back to the red lane on the left face (a little distance further up that where we started). Again, the simplest way to do this is if there was a branch from the red lane on the top face, that lets you turn 90° to the left, then turn 90° from the top face to an extension of the left face -- since otherwise you'll end up going against the direction of traffic in the red lane. Then you can merge back to the red lane on the left face and continue going up. But once you do this, though, you'll be driving on the red lane in a flipped orientation from when you first started.
//
Note, however, that your original idea of having red rails (not to be confused with the red lanes in my picture, now we're talking about the individual rails that pair up to form a single lane) join only to red rails, and blue rails join only to blue rails, is actually workable -- but just not in the way you described it.

The idea here is that we can set things up so that the red rail, if we consider its entire extent throughout the entire road network, forms a 2D manifold that's
disjoint from the blue rails. You can imagine this as painting one rail of a pair red, and the other rail blue, and only ever connecting segments of rails that match in color. This then guarantees that no matter how twisted the road network may be, the red and blue manifolds are disjoint, and since the vehicle's wheels cannot jump from a red rail to a blue rail, it will always have a fixed orientation when travelling past any given segment of the road network.
The path that I described earlier is actually a kind of "Mobius twist" where the entire extent of the red rails actually includes the blue rails, so like the Mobius strip that only has a single surface, this makes the road network non-orientable, and thus allows you to travel through the same segment of road in two different orientations. If we distinguish between the rails in a rail pair, and only connect red with red and blue with blue, then this twist can never happen. The catch is that this distinction cannot be determined geometrically, since which pair lies "on top" vs "on the bottom" (or "on the left" vs "on the right") is ambiguous in 4D. So you have to
physically mark the rail segments in some way, maybe by actually painting one rail red and the other blue, or by having incompatible interconnects so that red and blue rails won't fit together when you try to join them, in order to be able to tell, when you're adding new roads, which rail should go where. (Or making the two types of rails different from each other, like having different sizes, with corresponding differently-sized wheels on all vehicles (say red rails are higher so red wheels are smaller, and blue wheels are bigger), so that it's impossible to join red and blue rails and impossible to put a vehicle on the road in the wrong orientation (the mismatch would be obvious when the vehicle can't stand upright when you put large wheels on the large rail and small wheels on the small rail).)