Creating An Invisible Slide Rail

From Rigs of Rods Wiki

Jump to:navigation, search

Here we will see how to use a Submesh Submesh to support nodes sliding across it. First lets make our rail using the editor of your choice (notepad, Editorizer, Blender, etc) create a box using eight nodes:

Step1.PNG

This was created with these nodes:

;id,    x,    y,    z
0, 2.00, 0.00, 4.00          
1, 4.00, 0.00, 4.00          
2, 2.00, 0.00, 6.00          
3, 4.00, 0.00, 6.00          
4, 2.00, 2.00, 4.00
5, 4.00, 2.00, 4.00
6, 2.00, 2.00, 6.00
7, 4.00, 2.00, 6.00
beams
0,1,i      5,3,i
2,3,i      0,6,i
4,5,i      1,7,i
6,7,i      4,2,i
0,2,i      7,3,i
1,3,i      0,5,i
5,7,i      1,4,i
4,6,i      6,3,i
4,0,i      7,2,i
5,1,i      1,2,i
6,2,i      4,7,i
5,6,i

Now we want to submesh the four long sides. I will modifying the crate for display purposes. Make sure that the meshes are on the internal walls.

  • Note: There is the contactable option ",c" added to the end of each mesh.
submesh
texcoords
0, 0.000, 0.000
2, 1.000, 0.000
4, 0.000, 1.000
6, 1.000, 1.000
cab
0,4,2,c
2,4,6,c
backmesh
submesh
texcoords
1, 0.000, 0.000
3, 1.000, 0.000
5, 0.000, 1.000
7, 1.000, 1.000
cab
1,3,5,c
5,3,7,c
backmesh
submesh
texcoords
4, 0.000, 0.000
5, 1.000, 0.000
6, 0.000, 1.000
7, 1.000, 1.000
cab
4,5,7,c
4,7,6,c
backmesh
submesh
texcoords
0, 0.000, 0.000
1, 1.000, 0.000
2, 0.000, 1.000
3, 1.000, 1.000
cab
1,0,3,c
3,0,2,c
backmesh

After setting up your Material File,.truck file and texture (any for now) with required section, you should now have this:

Step2.PNG

These internal walls can now be used to slide our nodes along. "But what nodes?" I hear you say... This brings us to our next step. We now want to create a moving box that will be our sliding component. This needs to be just small enough to fit inside our already made rail.

Step3.PNG

See above that I have put the nodes 0.02 meters inside the rail to ensure that the nodes are on the inside when you get in. It's advisable to be at least 0.01 meters from the rail internal walls. Now that we have the box inside the rail, we need to make it contact the inner walls of the rail, this is done by adding the nodes of the sliding box to the contactable section in our truck file.

contacters
8
9
10
11
12
13
14
15

All that is needed now is our movement, here I will use commands, but you could use hydros, or even a rotator as a cam! (many ideas!) Place commands between one end of the rail and the near end of the sliding box, in a scissor pattern. Step4.PNG

commands
2, 11, 1, 2, 2.0, 1, 2, v
3, 9, 1, 2, 2.0, 1, 2, v
6, 9, 1, 2, 2.0, 1, 2, v
2, 8, 1, 2, 2.0, 1, 2, v
7, 8, 1, 2, 2.0, 1, 2, v
6, 10, 1, 2, 2.0, 1, 2, v
7, 11, 1, 2, 2.0, 1, 2, v
3, 10, 1, 2, 2.0, 1, 2, v

Finally all you need to do is make the texture invisible and presto you have an invisible rail. Heres one I made earlier, the tower crane with its texture file missing: Step5.PNG

You can see the submesh is along the crane's boom, and I made sure to split it along each section of boom so the weight was realistically distributed. Also here I only used one sliding surface; the box is held along the middle of this surface using triangulated commands.


If you think this guide not helpful then let me know, I will probably improve it a little. -KevinMcE