How to animate train to follow a path

Hi,

I'm trying to animate a train car to follow a path. I've created the actors; train car, leading axle and trailing axle. I've attached the train car to the leading axle and the trailing axle to the train car. I've then defined the leading axle to follow a path and given a specified time so I can see it in motion. Issue here is that when I run the script, on curve path, the trailing axle will be thrown out of the path.

How do I move the trailing axle so that it will follow behind the leading axle following the same path and thus rotate the train car accordingly (similar as how a train car moves in reality)?

Thanks in advance,

Lina

Parents
  • I think your best bet would be to attach all three actors to the path using path distance method so all are moving along path at same speed the the axle actors will align to the rail. I set your Actors to all be traveling at 18*tSeconds or 18 Meters per second which is 64.8K per hour you can adjust this to be the speed you need.

    We plan to make it easier to animate trains in the future.

    Cheers,

    Jerry

    train.dgn
  • Thanks Jerry,

    I've noticed when I run the script that the axles run out of the original 1600mm position when going around curves. I've managed to settle that by playing around with the timing of the two axle.

    Then I've noticed that the horizontal line of the train car is not in line with the mid-of axles when going around the curves.

    Any suggestion as to how to get the train car to move and rotate based on the 2 mid-of axle position? In other words, the train car is moved and/or rotated based on the position of the 2 axles mid point.

    Thanks,

    Lina

  • I would love to see a movie of what you have made, as what you are doing is pretty complex animation for microStation.
    There really is no "constrain" or physics options in this here CAD-software is there?

    Sorry I cannot help, but I wish you GL :)

    System: Win7 64bit 16GB Ram - microStation V8i SS3 08.11.09.578. + PoinTools CONNECT. - Intel i7-4800MQ CPU@2.70GHz, 4 core / 8 Logic proc.

  • Hi Lina,

    You need Inverse Kinematics (IK) and constraints which the current Animator does not have. IK is very high on our to do list for future version. If I can think of a better cheat I will let you know.

    Cheers,

    Jerry

  • Hi Lina,

    Try attaching the two axle actors to to the path as Jerry suggested, and then attach the train car actor to the rear axle actor instead of the path. 

    Now use the Script Target command to point the train car actor at the front axle actor by setting the Object to the train car actor and the Target to the front axle actor.

    This should keep the train car in line with the axles.

     

    HTH,

    Ron

    (My example boxcar_AnimTest.dgn is attached)

    boxcar_AnimTest.dgn
Reply
  • Hi Lina,

    Try attaching the two axle actors to to the path as Jerry suggested, and then attach the train car actor to the rear axle actor instead of the path. 

    Now use the Script Target command to point the train car actor at the front axle actor by setting the Object to the train car actor and the Target to the front axle actor.

    This should keep the train car in line with the axles.

     

    HTH,

    Ron

    (My example boxcar_AnimTest.dgn is attached)

    boxcar_AnimTest.dgn
Children
  • Good one Ron I was thinking to give this a shot it is similar to how I animated the tractor trailer rig in my animation book but to be honest was too slammed with a million other things. Thanks for helping Lina out.

    Cheers,

    Jerry

  • Hi Ron,

    I'm trying to replicate what you have done, but somehow I can't. I've created the axle actors with origin at centre, I've created train actor with origin at the rear axle. I've attached the train to the rear axle. I've defined actor path for the 2 axle. And last but not least I've used the Script Target with target activated on, train as object and front axle as target. But when I run the script, the car would just detach itslef and run on it's own. Is there any thing that I've missed out? I've tried doing this in 3d; same effect.

    How'd you do it?

    Lina

  • When you create the train box car actor you need to rotate the actor's origin such that it's Z axis (blue weighted line) is pointing away from the front wheels. If you open Ron's example you will see this in the front view.

    Cheers,

    jerry

  • Wow! Thanks guys! Finally got my simulation to work! Didn't know that the actor's origin makes a big difference. Mind explaining why is this so? I thought the car body moves in the same axis as the axle...

    By the way, the axle still did not maintain the same distance apart when running the script. But I guess this is a good start.

    Thanks a lot,

    Lina

  • Nice one Ron,

    Lina,

    The Target Tool is designed to work with Camera. With the Camera as object ,the  Z axis of the Camera ( which is in the direction of Camera view) needs to points at the target. Thats the reason why we need to set the Z of the object ( box) pointing to the target ( front wheel).

    Rg,

    Nilesh