1. Hey there Guest,

    The game servers have moved to semi-dedicated hardware and IPs have changed. Please see front page server widget for up-to-date game server information.

[Tip] func_tracktrain and wheels

Discussion in 'Tutorials & Resources' started by YM, Apr 4, 2014.

  1. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,920
    The func_tracktrain entity has annoyed me for a long time. It seems like setting the 'Distance Between the Wheels' keyvalue was always guesswork to get the smoothest cornering. But with a little experimentation (and some help from Boojum) I've got it figured out.

    This isn't particularly important for payload carts since they're quite short, but anything longer will be helped by the correct settings outlined here. Where it will really help though is if you have multi-carriage trains.

    I've always noticed multi carriaged trains will swing wildly around and the joints between them would have long sheared if that much force was actually being applied.

    Anyhow, enough ramblings and onto what settings to use:

    The origin of the tracktrain
    Move the origin to the centre of the back axel. This is where the train is driven from.

    The Distance Between Wheels keyvalue
    Set this to be the distance, in hammer units, between the centre of the back axel and the front axel

    How this works:
    -The train is driven by the back axel. The back axel always stays on the track line shown in hammer.

    -The front axel stays on the track until it passes a path_track. Then it starts turning. It does not stay on the track. Instead the train simply turns so that by the time the back axel reaches that path_track the front is in line with the track again. This means if your corner is sharp, the train won't follow it nicely.

    -Another very small consideration is that trains don't quite follow path_tracks perfectly. They don't turn right and drift a little but it's very hard to notice unless you're doing any precise tracks. Even if you are it's usually not a problem.
     
    • Thanks Thanks x 2
  2. henke37

    aa henke37

    Messages:
    1,954
    Positive Ratings:
    465
    Great, now the origin is used for two things at once.
     
  3. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,920
    The Origin is used for the camera of payload carts, but the origin for a tracktrain doesn't have to be at the same height as the axel, so while your camera might be offset from the centre, it doesn't have to be way down low.
     
    • Thanks Thanks x 1