func_tracktrain (Half-Life) Last edited 15 years ago2009-07-30 00:14:23 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older articles are no longer useful, or they duplicate information from other pages. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.
Brush Entity

This entity allows you to create a player-controllable train / platform etc. that follows a path.

Attributes

[list]
[li]0 = Normal [li]Render Mode (rendermode) - Controls the type of rendering that is used for an object. Options are: [li]Global Entity Name (globalname) - If your trian is going to cross level transitions, it'll need a global name.[/li]
[li]FX Amount (renderamt)[/li]
[li]FX Color (rendercolor)[/li]
[li]ZHLT Lightflags (zhlt_lightflags)[/li]
[li]Light Origin Target (light_origin)[/li]
[li]First stop Target (target) - The name of the path_track to start at.[/li]
[li]Sound (sounds) - Values:<BR>
0 = none<BR>
1 = rail 1<BR>
2 = rail 2<BR>
3 = rail 3<BR>
4 = rail 4<BR>
5 = rail 6<BR>
6 = rail 7[/li]
[li]Distance between the wheels (wheels) - This determines how the train behaves when turning corners. Generally the length of the object works here.[/li]
[li]Height above track (height) - This is the height above the path_track that the train will ride, based on the location of the train's origin brush.[/li]
[li]Initial Speed (startspeed) - The speed the train starts at, until overridden by player control or path_track settings.[/li]
[li]Speed (speed) - The maximum speed the player can make a controllable train go in units/second.[/li]
[li]Damage on crush (dmg) - If train movement is blocked by the player, deal out this much damage.[/li]
[li]Volume (volume) - Range: 0 - 10.[/li]
[li]Bank angle on turns (bank) - This is the angle the train will tilt when cornering.[/li]
[li]Minimum Light Level (_minlight)[/li]
[/list]

Flags

Notes

3 Comments

Commented 10 years ago2014-11-24 15:31:52 UTC Comment #101139
Hmpf. Anyone know a trick to make func_tracktrain?
Commented 10 years ago2014-11-26 00:52:09 UTC Comment #101140
I'm experimenting with func_tracktrain at the moment.
I'll make a tutorial on my channel if I figure it out.
Commented 11 months ago2024-01-05 12:12:36 UTC Comment #105848
Some findings about func_tracktrain:
  • wheels distance is only measured forward from origin. To make the train travel as much on the path as possible, the origin needs to be located at the center of the back axle.
  • wheel distance defaults to 100.
  • target of a path_track is fired when the origin passes the path_track.
  • the position and angle is set wrt the origin point as follows:
    1. trace a line forward.
    2. if there's enough distance to the end of the current path, keep heading
    3. if wheel distance > distance to next path, subtract current distance to next path, then iterate the path forwards until the distance fits the path. the point where distance is 0 is the new heading.
    4. origin moves forward
    5. angle is adjusted to point to the heading. this will in all cases be shorter than wheel distance; the sharper the curve the more noticeable. this also means the front wheel part will always overshoot the path. but the origin is guaranteed to always be on the path.

[2024-05-12] While I am a proponent of the origin at the back axle, more realistically moving trains, I can see how it is totally incompatible with track [auto]changers. Gotta have to pick your poison, I guess.
[2024-05-13] Also, a tutorial for track trains is needed.
[2024-07-10] You can control a func_tracktrain remotely using game_counter_set entities. Value 1 throttles up one notch, -1 down a notch.

You must log in to post a comment. You can login or register a new account.