Sun, Dec 1, 12:51 PM CST

Renderosity Forums / Blender



Welcome to the Blender Forum

Forum Moderators: Lobo3433 Forum Coordinators: LuxXeon

Blender F.A.Q (Last Updated: 2024 Nov 24 8:44 pm)

Welcome to the Blender Forum!


   Your place to learn about Blender, ask questions,
   exchange ideas, and interact with the other Blender users!


   Gallery | Freestuff | Tutorials

 

Visit the Renderosity MarketPlace. Your source for digital art content!

 





Subject: Train following track


3dscribbler ( ) posted Thu, 22 August 2013 at 1:55 PM · edited Fri, 29 November 2024 at 7:40 AM

file_497521.jpg

I'm trying to set up a scene with a train consisting of a few individual cars, each of which has two sets of wheels (rotating bogies with 4 wheels each). The idea is to make this train follow any path, as though it were placed on tracks.

I've searched around a lot, but I can't get more than making an array follow a path (useful for making the tracks themselves) and even that always seems to have a different orientation than I had in mind.

I hope someone here might have an idea on how to get an entire train to follow a path, instead of just one object (which I also fail to achieve).

To keep things as simple as possible I just created three blocks and a path (I attached a picture). The smaller blocks need to be anchored to the large block but at the same time follow the path.

Any ideas?


Lobo3433 ( ) posted Thu, 22 August 2013 at 2:26 PM
Forum Moderator

Hello 3dscibbler

I remember a post similar to this not to long ago on a tutorial Create an Underground Subway Scene – Part 1 of 2 where he is setting up a tunnel that curves along a Nurbs path and curve that I think might give you some insight into how to accomplish what you are wishing to do. I hope it gives you some help

Lobo3433

Blender Maya & 3D Forum Moderator 

Renderosity Store

My Free Stuff

Facebook

Twitter

Renderosity Blender 3D Facebook Page



heddheld ( ) posted Fri, 23 August 2013 at 2:18 AM

I cant tell you exactly what to do (never tried a train lol)

but its all to do with parenting each "car" to each other then the main car (root) is set to follow path *path can be same bezier you used for track

blender artists will have a few threads on thsi so have a look there

or the blender wiki has good (ish) info on all the constraints

(sorta remember "child of" is not quite the same as make parent but cant remember why so watch for that)

 

"instead of just one object (which I also fail to achieve)."

always make sure you have done apply rot/scale (object mode ctrl+A)


3dscribbler ( ) posted Fri, 23 August 2013 at 2:19 PM

Thanks both, I did see the subway tutorial, that's how I learned to make tracks follow a curve, but it did not explain how to make a train drive on the tracks.

If I parent each car to its front car, all the way up to the engine and let the engine follow a path, won't that mean that all the cars will rotate along with the engine as though they were one long rigid object?

I managed to make the big section follow the path by using the constraint "follow path" and setting the "follow curve" option, but for some reason it only follows the path in th positive y-direction if I give "offset" a negative value. Regardless of setting the forward direction to Y or -Y.

Also, when I set the smaller objects as a child of the bigger one, they are just rigidly attached to the big object, I can't seem to make them follow the same curve, while sticking to the large object.

 

There seem to be a lot of issues I need to understand better, I'll try searching the blender artists community as well.


pauljs75 ( ) posted Tue, 17 September 2013 at 12:00 PM

Might want to use constraints and have the bogies follow the path. May also have to do some math to offset the F-curve path position start and end for each. (Basically you get all your wheels following the path while being spaced as if they had the cars and engines attached. Make path slightly longer. Offset start and ends of each so they don't pile up when animated.)

If you can make a group of bogies follow the path at the correct intervals, then it should be a matter of constraints and/or rigging (with IK?) to attach cars to those bogies.

Sounds tricky and complicated (and it most likely is), but may be a more realistic looking way of doing it than making just the cars follow the track and not caring which ways the wheels point or trying to get them following the path after the fact.

Alternately bullet physics with rigid bodies may accomodate what you want to do as well. But then you run into issues of tolerances and weird simulation behavior with offsets and the occasional miscalculated collision. A physics simulation may be more intuitive, but the unexpected stuff might have you pulling more of your own hair out.

Haven't done it yet, but I can picture how it should work in my mind. I might have to try this outside of my all-too-short lunch break.


Barbequed Pixels?

Your friendly neighborhood Wings3D nut.
Also feel free to browse my freebies at ShareCG.
There might be something worth downloading.


pauljs75 ( ) posted Tue, 17 September 2013 at 9:20 PM

I managed to get a crude version of the idea working for a single rail car.

Front and rear bogies are individually set up with a follow path constraint that has follow curve turned on. Each bogie also has an empty axes set as a child offset at the same height above its center. The car is set as a child to the empty axis above the front bogie. The front empty axis is also set to point-at the rear one. Then set the offsets for the front and rear bogies under the follow path constraint. (Don't offset by just moving them, it throws them off the path.) It'll take some adjusting to make sure everything is aligned and pointing the right way. (Offset value in follow path constraint isn't same as global distances afaik.)

But if you do it all right, you'll have the wheel bogies follow the track almost perfectly, and the car will stay in line over the bogies. Animate by using settings on the curve itself under path animation.

You may have your work cut out for you in animating an entire train. But it's definitely possible to have it follow the rail in a fairly realistic manner.

I also tried some other way with bones and IK stuff but wasn't having much luck. The empties and regular ol' constraints seem to work with the least fuss. (Although there might be a better way. I'm still new at it.)


Barbequed Pixels?

Your friendly neighborhood Wings3D nut.
Also feel free to browse my freebies at ShareCG.
There might be something worth downloading.


pauljs75 ( ) posted Fri, 20 September 2013 at 8:42 PM

Enough talk... I'll just show how to do it, even though I'm a bit clumsy with this software still.

http://youtu.be/bL00aXePHUA


Barbequed Pixels?

Your friendly neighborhood Wings3D nut.
Also feel free to browse my freebies at ShareCG.
There might be something worth downloading.


3dscribbler ( ) posted Tue, 24 September 2013 at 9:46 AM

That's exactly the kind of tutorial I was hoping to find :). Thanks a lot! I'm sure it'll be helpful to others too.


pauljs75 ( ) posted Tue, 24 September 2013 at 4:50 PM

You're welcome. :)

If anyone is curious, the results are like this:
http://www.youtube.com/watch?v=Ui-gSaI_du0

I still consider this halfway done though... Why?

I can't figure out getting wheels to roll properly while following the path. It doesn't matter if wheels have no visible texture or smooth geometry like in the linked example, but it would matter if you had wheels with texture or bits of stuff attached like drive wheels on a steam engine. Rigid body physics behaves a little wonky with constraints (at least I'm not having luck), and I'm nowhere up to speed on driver or Python scripted animation. I know part of it involves knowing the wheel diameter (easy enough via correct object dimension) to get circumference (using some circle math involving pi) and then path length in units (count 1 unit boxes arrayed to fit path to get close) to figure out number of rotations (path length divided by circumference), but the exact details is where I get lost. (Getting Blender to do all that for you. I sorta know what has to be done, unfortunately just not Python and/or drivers part.)

If only I it were possible to port the Sparrowhawke3D wheels modifier Carrara plugin to Blender. (It's not, but something equivalent would make life easy.)


Barbequed Pixels?

Your friendly neighborhood Wings3D nut.
Also feel free to browse my freebies at ShareCG.
There might be something worth downloading.


pauljs75 ( ) posted Tue, 24 September 2013 at 6:33 PM

I did a little more research on the wheels thing. It seems I'm going to have to re-do the process yet again, but with armatures to get the wheels on the cars to turn. (The answer lies in the topic of animating wheels on cars - but not the railroad kind.) It might be a tad more trickier, but to get it done right that's what's needed to happen.

Seeing how the armature does it via transforms instead of needing scripts just goes to show how much a blender noob I am. :blink:

At least I'll admit it. :laugh:


Barbequed Pixels?

Your friendly neighborhood Wings3D nut.
Also feel free to browse my freebies at ShareCG.
There might be something worth downloading.


heddheld ( ) posted Wed, 25 September 2013 at 2:20 AM

looks like you almost have it ;-) well done

will watch your tut an maybe learn a new trick or two

 

is a couple of threads on BA about tank tracks maybe you'd see something in them to help


pauljs75 ( ) posted Fri, 04 October 2013 at 12:17 AM

Transforms modifier wasn't exactly right either. And I figured out scripts had to be purposely enabled to work and such...

Going back to animation drivers is the right way. Particularly if it's distance along path and not just a particular direction which you want to affect rotation. So another video...

http://www.youtube.com/watch?v=h9V_47SD7wg

Only oddball thing is that I had to use an array object to find the path length in Blender units. (Shown in video.) If there's an internal property for that, it's somewhere where I couldn't readily find it.


Barbequed Pixels?

Your friendly neighborhood Wings3D nut.
Also feel free to browse my freebies at ShareCG.
There might be something worth downloading.


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.