script suggestion: matching wheels to terrain

I have noticed, that when animating a car over a terrain, it can be very difficult to keep all the wheels on the ground. The edge to curve script can be helpful, but that is only good for gentle curves. The other way, that sort of works, is to bake a physics anim of an object or objects literally pushing your vehicle around the terrain. Though this sort of works, it can be pretty hard to control. So, if anyone is looking for a challenge… :ba:

I have a crazy idea that might work for you without having to write a custom script. Maybe you could use the decimator (or poly-reducer script) to create a low-poly version of your terrain and use erwin’s car physics demo to record the physics to IPO just for the animation. Then, just select the object with the IPO (the low poly car) and delete all the verticies in that object and copy all the verticies from your own car mesh into it. This way, you can keep everything low poly during the recording of the physics, but use the same IPO for the high poly animation. I’d suggest limiting the polygons to around 25-30k or so depending on your system specifications during the actual realtime simulation.

Here’s the link to the demo:

The name of the file you’ll want to use is vehicle3_Steering fix.blend

I hope this helps you with your animation. If there’s something I said that you don’t understand just let me know and I’ll clarify it for you.

Good Luck.

Edit: I know you’ve mentioned this idea already in your first post, but I think the demo in the link I sent you has really good controls. I’m not sure how rugged your terrain is but it should work for most cases.

I’ll look into that. I have done a coupel of anims using low poy stand ins, utilizing the physics engine, then substituting high poly versions for the rendered animation, but ran into the problem of the frame rates not translating well to the animation.

You need to change the physics system tic rate in order to get it to match the framerate of your animation. The Game Engine physics tic rate is set to a default of 60 fps (because that’s an accepted standard for game speeds), but your animation is probably something like 25 fps. Those rates won’t match well at all.

You need to run a Python script at the game startup to change this. I assume you know how to do this since you’ve used the Game Engine in the past… but just for refreshers, use an Always sensor with TRUE Level Triggering (pulse mode) turned off (it’s on by default). This will make the sensor fire only once at startup and never again. Hook it to a Python controller that calls this script:

If your animation framerate is not 25fps, then replace the 25’s in the script with whatever number you are using. Also, be sure that you have “Enable All Frames” turned on in the Game menu before running the simulation.

thanks blendezo