This article's documentation is for anything that uses the Source engine. Click here for more information.

Func tracktrain: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎top: clean up, replaced: {{EntityTabs → {{tabs)
(This is an assert and therefore doesn't exist in public builds)
Line 7: Line 7:
{{bug|Due to poor coding, the <code>Reverse</code> and <code>StartBackward</code> may not function correctly if the <code>New Train Speed</code> property in the involved {{ent|path_track}} entities is set to 0. The train may fail to reverse, jamming in place or moving in the wrong direction. To solve this issue, some or all of the <code>path_tracks</code> must have their <code>New Train Speed</code> variable set to a non-zero value.}}
{{bug|Due to poor coding, the <code>Reverse</code> and <code>StartBackward</code> may not function correctly if the <code>New Train Speed</code> property in the involved {{ent|path_track}} entities is set to 0. The train may fail to reverse, jamming in place or moving in the wrong direction. To solve this issue, some or all of the <code>path_tracks</code> must have their <code>New Train Speed</code> variable set to a non-zero value.}}
{{bug|Trains stop short at a distance from their targets, regardless of speed. The higher the speed, the further away it will stop from the path_track. At low speeds, this is negligible.}}
{{bug|Trains stop short at a distance from their targets, regardless of speed. The higher the speed, the further away it will stop from the path_track. At low speeds, this is negligible.}}
{{warning|Trains need to have the same parent as the track nodes they follow (such as no parent at all). Failure to obey this rule is an intentional crash.}}


{{Code class|[https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/game/server/trains.cpp#L1246 CFuncTrackTrain]|[https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/game/server/trains.cpp trains.cpp]}}
{{Code class|[https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/game/server/trains.cpp#L1246 CFuncTrackTrain]|[https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/game/server/trains.cpp trains.cpp]}}

Revision as of 13:22, 27 March 2024

Not to be confused with func_tanktrain.

func_tracktrain is an e2 available in all Source Source games. It functions as a moving platform that the player can ride. It follows a path of path_track entities.

Note.pngNote:Unless the Fixed Orientation flag is set, build your train so that the front of the train is facing down the X axis. (This means that the front of the train is visible in the front view, etc.) When it spawns it will automatically rotate to face the next path_track on the path.
Note.pngNote:Tracktrains only update their movement direction 10 times per second. At higher speeds, this can result in them overshooting the track, especially with sharp turns. The older func_train entity is not affected by this issue, so it may be a suitable alternative for high-speed objects.
Icon-Bug.pngBug:Due to poor coding, the Reverse and StartBackward may not function correctly if the New Train Speed property in the involved path_track entities is set to 0. The train may fail to reverse, jamming in place or moving in the wrong direction. To solve this issue, some or all of the path_tracks must have their New Train Speed variable set to a non-zero value.  [todo tested in ?]
Icon-Bug.pngBug:Trains stop short at a distance from their targets, regardless of speed. The higher the speed, the further away it will stop from the path_track. At low speeds, this is negligible.  [todo tested in ?]
C++ In code, it is represented by theCFuncTrackTrainclass, defined in thetrains.cppfile.

Keyvalues

Template:KV BaseTrain

Distance between wheels is the distance in Hammer Units between the front axle and rear axle of your train. The rear axle moves the train and stays on the track. The front axle turns as it approaches path_tracks and does not stay on the track.

Flags

Template:Fl BaseTrain

Inputs

Template:I BaseTrain

Outputs

Template:O BaseTrain