Getting the Track Position
While I am still in the process of completing the Track Position Plugin, I wanted to give a few more methods of getting a track position.
Using the Plugin
At the moment, the Track Position Plugin only supports PointToPoint based tracks.
To use, load the track you want to use by selecting the Point Model (the model that contains the numbered points) in the workspace and clicking the Select Track
button.
Then, select any child of the Point Model to get the track position of it.
Finally, use can copy the position from the Position TextBox.
Current Limitations
- Does not have a memory for the last selected positions. This means that your position will go away after if you select something else.
The Math Method
This method involves some Command Bar work and some Vector3 math.
This method also assumes that the sections that the train will switch from and to are relatively straight (i.e., have no curve).
Sometimes you need the EXACT position that say a train or model needs to reach.
This is especially needed when switching tracks or jumping to an overlapping section of track so that the train or model makes the transition look seamless.
- Get the exact ENTER track position, or where your train will track switch FROM.
- Since the enter position will influence where it will be when it switches (to the exit), it's important to get the exact track position.
- We especially use the enter position because our animation reaches this first.
- Get the closest brick to the EXIT track position, or where your train will track switch TO.
- Get the Vector3 world positions for both of these.
- Use the Magnitude between these two Vector3 world positions to determine what to offset the EXIT track position by
local s = game:GetService("Selection"):Get()
local s1 = s[1]
local s2 = s[2]
print((s1.Position - s2.Position).Magnitude)