28
« on: November 14, 2012, 11:42:10 pm »
Making a track switch is probably one of the most complicated things in BVE Route building, so don't feel bad..
Remember that a route for BVE travels on a single fixed path, which means you will have to move everything else to accommodate the single fixed path. That single fixed path is the track that you are travelling on, aka track 0. As you know, the locations for all other objects, rails, etc. is defined and measured from track 0.
I don't know the exact circumstance of what you are trying to do (I don't have this route installed on my new computer), but I'm going to assume it is a standard 50 meter 2 track X cross switch.. If this isn't the case, the concept is still the same, just switch around some of the numbers and make sure everything is in proportion.
The theory behind making a track switch is to keep re-aligning everything else as you progress so it looks correct. Assume we are starting on the right side track switching to the left side track. We start our switch by making the turn command and defining the proper distance of the other track (track 1).
1000@turn(-0.16)@rail(1,-4,0)
Once we reach 25 meters into the switch, we hit the center of the X. So we re-align track 1 to be right on top of our track.
1025@rail(1,0,0)
Once we reach the end of the switch, track 1 will be on the other side. So we re-align track 1 to the right side and complete the turn.
1050@rail(1,4,0)@turn(0.16)
We now made the actual crossover.. But you will notice that all you see is an X and there are two gaps - what if the train isn't switching tracks? We will have to temporarily start/end two new tracks to make up for those.
Back to the start of the switch, we start our two new tracks. We start one track (2) on top of our track to fill in the right side gap, and we start another track (3) on the other side to fill in the left side gap.
1000@railstart(2,0,0,0)@railstart(3,-4,0,0)
Once we reach the center of the X, we will have to re-align those two tracks again. Since the two tracks were originally 4 meters apart, the mid-point would be 2 meters. So we align tracks 2 and 3 to be 2 meters away from track 0's location. Remember, track 2 fills in the right side gap and track 3 fills in the left side gap.
1025@rail(2,2,0)@rail(3,-2,0)
When we complete the switch, we will now be on the left side. Therefore we will have to re-align and end tracks 2 and 3 with the following code
1050@railend(2,4,0)@railend(3,0,0)
Our final code will look like this:
1000@turn(-0.16)@rail(1,-4,0)@railstart(2,0,0,0)@railstart(3,-4,0,0)
1025@rail(1,0,0)@rail(2,2,0)@rail(3,-2,0)
1050@rail(1,4,0)@turn(0.16)@railend(2,4,0)@railend(3,0,0)
The concept may be a bit tricky to grasp at first, but if you visualize it (no time to draw a diagram right now, if you must i'll do it in the future) it will become pretty easy.