func_tracktrain Last edited 4 years ago2020-06-01 09:25:21 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.
Brush Entity

This entity allows you to create a player-controllable train / platform etc. that follows a path consisting of path_tracks. Unlike func_trains, func_tracktrains will automatically face the next path_track, similar to how real-world vehicles behave.

Attributes

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 10 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.