Animating Steam Locomotive Rods

Willkommen in der Transport Fever Community

Welcome to the fan community of Transport Fever and Train Fever, the economic simulators of Urban Games. The community is free for you to share and inform yourself about the game. We cultivate a friendly and objective interaction with each other and our team will be happy to answer any questions you may have.

 

Registration and use is of course free for you.

 

We wish you a lot of fun and hope for active participation.

The Team of the Transport-Fever Community

  • How to animate the piston, the coupling rod and the connection rod of steam locomotives.

    Preparation


    First of all you need to create the different colored parts in this picture:
    [Blocked Image: http://www.train-fever.net/index.php/Attachment/14704-TrainFeverRodAnimation-jpg/]
    - One Wheel (blue)
    - One Piston (red)
    - One Connection Rod (yellow)
    - One Coupling Rod (green)


    You don't need need all of the parts to make them move, if you have let's say a shunter with a coupling rod, you can only create that one.


    Each part should be mirrored to the other side of the locomotive so you don't need to create more models just to have the coupling rod on the opposite side at a different position (like they are in real life).


    You can basically have a different origin for all of your single meshes, but then you would have to enter the different positions of the mesh in the group file. Let's keep it simple and have them all set up like in the picture above.




    Animating the Piston
    Open the piston's .msh file, find

    Code
    function data() return {
    animations ={ },


    and replace it with

    Code
    local vec2 = require "vec2"
    local vehicleutil = require "vehicleutil"
    
    
    function data() return {
    animations = { drive = vehicleutil.makePistonAnim(vec2.new(X1, Y1), vec2.new(X2, Y2), vec2.new(X3, Y3)) },


    Replace X1 and Y1 with the position of WheelCenter in meters.
    Replace X2 and Y2 with the position of WheelPos0 in meters.
    Replace X3 and Y3 with the position of PistonPos0 in meters.


    In this case it's:
    X1 = 0
    Y1 = 0.682405
    X2 = 0
    Y2 = 0.47
    X3 = 2.26
    Y3 = 0.9


    Make sure you use as exact as possible values, otherwise the position of the rods won't match the position of the wheel after some time!




    Animating the Coupling Rod


    Open the coupling rod's .msh file, find

    Code
    function data() return {
    animations ={ },


    and replace it with

    Code
    local vec2 = require "vec2"
    local vehicleutil = require "vehicleutil"
    
    
    function data() return {
    animations = { drive = vehicleutil.makeCouplingRodAnim(vec2.new(X1, Y1), vec2.new(X2.Y2)) },


    Replace X1 and Y1 with the position of WheelCenter in meters.
    Replace X2 and Y2 with the position of WheelPos0 in meters.


    In this case it's:
    X1 = 0
    Y1 = 0.682405
    X2 = 0
    Y2 = 0.47


    Make sure you use as exact as possible values, otherwise the position of the rods won't match the position of the wheel after some time!




    Animating the Connection Rod


    Open the connection rod's .msh file, find

    Code
    function data() return {
    animations ={ },


    and replace it with

    Code
    local vec2 = require "vec2"
    local vehicleutil = require "vehicleutil"
    
    
    function data() return {
    animations = { drive = vehicleutil.makeConnectingRodAnim(vec2.new(X1, Y1), vec2.new(X2, Y2), vec2.new(X3, Y3)) },


    Replace X1 and Y1 with the position of WheelCenter in meters.
    Replace X2 and Y2 with the position of WheelPos0 in meters.
    Replace X3 and Y3 with the position of PistonPos0 in meters.


    In this case it's:
    X1 = 0
    Y1 = 0.682405
    X2 = 0
    Y2 = 0.47
    X3 = 2.26
    Y3 = 0.9


    Make sure you use as exact as possible values, otherwise the position of the rods won't match the position of the wheel after some time!




    That's it!
    Once you import the rest of the locomotive properly, you're done.


    If you need any help regarding this topic, leave a comment.


    Choo choo!

Share