Posts Tagged ‘tracks’

In this post I will cover how to use func_TankTrain. Func_TankTrain is a brush entity available in all Source games. It is a moving train that follows a path of path_track entities.

For this tutorial you will require few things;

  • A block, which we will tie to entity func_TankTrain
  • Couple of path_track (To set the path that block will take through the world)
  • A prop_dynamic (for the purpose of this post)

Lets start by creating the path that our tank will take. To do this select the Entity Tools and in the Object dropdownlist search for ‘path_track’. Once you have found it, left click in the world to add one. Double-click the the path entity to open its properties, and give it a name e.g. path1.

path

Now duplicate it be select the first path and drag it to second location. Before letting go of the right-mouse button, hold down the shift button and then let go. You will notice that a line connecting the the two paths. Also the second path_track will be given a name.

path2

Now we move on to creating the block with func_tanktrain. I will add prop that I would want to move. Add prop_dynamic entity of your choosing, I will go with the pi_apc.mdl model.

path3

If you using an prop entity, then you will be required to create a brush that will have the invisible texture applied to it. To do this click the Browse button on the right side of the editor to open the Textures window. Filter for invisible and double click the texture to select it.

invi

Now click the Block Tool and create a template of the brush. Make sure the template covers the prop, then hit enter to create the brush. Then select the brush and hit Ctrl+T to open the object properties. Under Class dropdownlist search for ‘func_tanktrain’, select it and hit apply.

path4

Now we move on to setting the properties for the func_tanktrain. This will require some in-game testing for figure out the correct settings. Also you may need to turn the brush and the prop so that It will be facing the same direction as the path.

If you want to rotate the prop and brush, select both of them, then right click and click on Transform. A Transformation window will  open up. To Rotate make sure the Mode is set to Rotate and insert a number to the Z textbox to rotate the objects.

Double Click the brush to open its properties. Here are few properties to take into account;

  • First Stop Target – The name of the first path_track in the train’s path. The train will spawn at this path_track. It will also turn to face direction indicated by the ‘Orientation Type’ setting.
  • Max Speed – The maximum speed that this train can move. Any speeds applied to this train, such as by path_tracks or SetSpeed inputs, will be clipped to this maximum value.
  • Initial Speed – The speed that the train will move at after it spawns, 0 = stopped.
  • Change Velocity – The method through which this train changes its velocity as it moves along the path.
  • Damage on Crush – The amount of damage this train does to entities that block it.
  • Health – The amount of health the entity has. Which can be drained when players do damage to it.
  • Start/Stop/Move Sound – A sound played when the train stops/starts/moving.
  • Height Above the Track – The height above the track that this train moves.

For the purpose of this post I will only set the important properties. Lets start with Height above the Track, to measure this use the side or the front viewport and create a template from the floor brush to the centre of the tanktrain brush.

path5

Set the Height above the Track to equal the value in the red rectangle (If the prop is not touching the ground or is within the ground, then you will need to come back and add or take away from this value).

We’ll leave Max speed to its default value of 100 and set the Initial speed to 50 (It’s important to set the initial speed or the tanktrain will just jump between the track points). Will set the Change velcitiy to Ease in/ease out, so the looks like starts slow, speeds up and then as it gets closer to the second path_track slows down.

Now we will set the First Stop Target (starting point of the tracktrain), which will be the first path_track entity (path1).

Will also set the damage crush to be 100 with the flag setting of it being unstoppable by player, this can be found under the Flags tab.

path6

To parent the prop to the brush, you will need to give the brush a name (e.g. apc) and in the prop properties under parent set it to equal that name.

Compile and run the level.

 

Complex Path

If you plan to make a route that goes through a road that that has corners then I recommend using more than one path_track at the corner to make the animation of the turn smoother. The more you add the smoother it will get Like so;

path7