Railroading concept

I’ve been interested in doing a railroad simulation. While I have managed to figure out all the other aspects of the sim I have yet to develop some kind of system to run a set of train wheels on tracks to guide the actual train.

It has become apparent that the concepts explained on the forum are really for a very simplistic track (helpful nonetheless,) but in my case I have a full working railroad with switching of track and other complicated situations where IPO will not work.

One concept that has gained my interest is with some kind of intelligent pathway device (which means I can have my train effected by physics also.) Attach empties to the the wheels and guide them with an actuator… Problem with that is when I have my train exit from a turn into a straight away it doesn’t go straight, but veer off erratically and shoot out into space. So my question is how do I make it compensate for it by steering it back on track?

I’m hoping I explained this thoroughly enough to receive some help…

the only way i can think of is to parent all the cars to the one before it ie. 2nd car to engine & 3rd car to 2nd.Then parent the engine to an empty . Hook the empty to a path or manually move it around your track path.Then you may be able to keyframe the individual cars.then you could play the animation in the game engine with an ipo accuator.
I might try this and see what happens.I’ll tell you what happens.

I’m leaning more to the idea of using empties to detect the sides of the track. What I did was made a track for a cube to go through, so that when it hits a curve with the property “rail” it turns. My problem is that when the train is going down a straight away it moves awkward per it’s physics properties. My goal is to somehow use the same concept as I did to turn the train to keep it straight – that’s where I’m stumbled.

Thanks for the help.

you can do a search in the forum, there’s already a nice train demo I guess
If not, there’s a “fast” sugestion
Maybe using Erwin’s vehicle, or not, only a physics object as main train and do invisible walls along the railtrack to guide the train
To make the train change rails make invisible walls with IPO movement so that when train aproaches they “block” one way and guide to another one

Here is an interesting idea I had although not a real “fix” for your problem. Make a train where the engine is controled by the player for speed. All the cars follow this train somehow. The track has invisible walls that the cars “collide” into and force it to follow the track. The train will control how fast or slow it goes and the walls will steer it. You could use an ipo activation to move an invisible wall at the parts where the track junctions to open like a door.

Would this work, or mess things up?


It works, but the locomotive itself behaves erratic and gets thrown off the track.

I suggest to use the waypoint script. I mean there is no real need to use physics to hold the train on the track. You only need to have enought waypoints. This also allows to switch tracks by following different sets of waypoints.

Only the TrackTo actuator wouldn’t be good enough. There are 2 problems with it:

  • sometimes it rotates into the wrong direction.
  • if your train stopps the actuator still rotates the train.

You would need a trackTo script that rotates the train to the next waypoint dependent on the distance of the last waypoint and not the time.
There should be a TrackTo script around in the forum.

I hope this helps

I think JD_Multi or someone had a train_ai.blend somewhere … anyone have one laying around?

Thanks for the reply.

It works perfect for what I want to do except as the train goes hits the curved wall it turns the train extremely awkward. That is the train turns in a jagged motion, :eek: especially at high rates of speed. Very nauseating when viewed from inside the train. :stuck_out_tongue:

I’ve been experimenting with Bullet Physics. It’s quite beautiful in how objects can interact with each other. What I did was took example from the vehicle physics demos and made it where you can only control the acceleration of the vehicle and not the direction. Then I ran this “car” through the curves of the track to see if it would align itself to the curve, it did, but again it was jagged motion and not seamless. :frowning: I’m convinced that Blender will provide a work around some how, either that I must not understand Blender enough to keep going on this project. :confused:

Anyone care to chime in?

Hey Rizzo

I like what you are trying to do. I have experimented with some similar sounding ideas as yours but in the end, like you, I couldn’t get a smooth result:( In the end I used the ipo actuator and I came up with this so far http://www.bentstraight.org/thetrainpage.html This has switches(points)
signals, loading of coal, hills and physics to go with that. Oops Sorry that is in the new version that isn’t uploaded yet.
I still need to develop
1)an effective system to keep things out of sight out of GE calculation for a decent framerate when details get high
2) A working way of de/coupling (I’m close)
3) A better texture (or system) for the track itself. If you download my effort have a look at the track when close to ground. Do you get that blurry average look on your version as well?
I’m limited by how many frames in the ipo blender can handle. Up to
30 000 I think. This limits track length and/or complexity and you have to decide on track and terrain geometry before anything else.
I can also do passing loops and a steam engine so really anything is possible.

Good Luck and keep us informed of your progress If there is anything I can do to help lets us know

Dr S:)

If anyone can help with a way to improve the look of my track you would have my eternal gratitude

Dr S

How about having the engine follow (tracking) empty or invisable block, when that block hits wall it takes the jolt of the direction correction. That might smooth out the corners somewhat.

I’ll be sure to follow your actions on this subject! I found that my problem is nearly solved with just using Bullet physics :slight_smile: Just now I have to figure out how to couple and uncouple trains and I’ll be set! I’m thinking about using the hinge constraint. Thanks for the replies.