I was working on a prototype of off-road tracked vehicle similar to this amphibious beast of engineering:
It was obvious that I should look into PhysX’s tank implementation but I’ve decided that first I want to get my own implementation in blueprints, to better understand what kind of forces are involved in simulation and how far you have to go in respect to reference materials.
Prototype started with a huge vehicle, supported by 10 wheels of 2 meter diameter (you can see it in demo). Later, to verify validity of the system, I’ve switched to M113 APC, as reference materials were somewhat easier to find:
What is implemented so far:
- Simple drive-train with engine torque/rpm curve of Detroit Diesel 6V53T engine that was installed on M113A1
- Semi-automatic gear box with automatic up-shift/down-shift (should be fully automatic) with proper gear ratios of Allison X200-4B, 3-forward and 1-reverse
- Simple spring and damper to imitate torsion bar suspension
- Traction of the vehicle is based on friction and torque translated from engine, with a set of separate longtitude-latittude friction coefficients
- Two set’s of rolling friction, “constant” which represents loss of energy due interaction of mechanical parts and “dynamic” which linearly depends on speed and very specific to tracked vehicles
- Simple friction based brakes
- Steering of the vehicle is done with differential, which transfers torque between tracks. This allows to do neutral turn - turning at sport by spinning treads in opposite directions. In case of M113 I need to change this logic as they are turning by braking one of the tracks.
- Two implementations for track animations. First one uses simple skinned mesh with animated texture. Second one uses instanced static mesh to render individual links.
- Dust particles are spawned depending on the landscape material
- Crude two way interaction of suspension with other objects. You can land on a back of the carriage and see that it effects it’s suspension. Driving over physics rocks is still a bit wonky but it’s not a static experience as it was before.
- Prototype of Aerosled GAZ-98 (RF-8) which is an early proof of concept for component based architecture of the vehicle
I’m sharing full source of this project on GitHub.
Code is not too well documented, this is something I need to work on.
Compiled demo M113, Ripsaw, Aerosled and Mark-I prototype:
[21-th of January 2016]Dropbox - TrackedVehicles.zip - Simplify your life
Trello board to track features and notes:
Press 1 to posses M113 -> Press E to shift into 1-st gear -> press W to push gas pedal.
Q/E to downshift-upshift gear. To go backward you need to switch to reverse gear and push gas pedal.
W to press gas pedal.
A/D to turn left or right. There is a different logic in place if you press them together with gas pedal (W). When pressed together with gas pedal one tread will start rotating faster in expense of other rotating slower. Without pressing gas, treads will try to spin in opposite directions.
S to brake on both treads.
Pay attention to engine RPM. Optimum RPM for this specific engine is around 1800 (green) the red-line starts around 2800, over that torque drops to 0.
Sometimes you will lose control of the vehicle - it won’t be able to turn, this is because the engine is in the red zone and there is no torque provided to tracks, either shift gear up or press on breaks.
Video Tutorial - How to get your own vehicle plugged into the system
OldRaven made this great video tutorial on how to setup your own tank using these blueprints. Thank you, OldRaven!
First part - how to change visual model:
Second part - wiring of wheels and suspension:
Third Part - setting up the splines for track animation