[ASSETS] [OPEN SOURCE] Tanks, tracks and N-wheeled vehicles

Hi guys,

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

just tried it, looks like you have a decent start, keep up the good work:D, I want to see how far you get with it because I have challenger tank model just waiting to be implemented:)

ps. it looks weird seeing the collision and stuff while driving;)

I had a base of M1A1 at some point, unfortunately I wasn’t able to find all necessary references for it, such as gear box, converter, differential ratios. I do have it’s power turbine. It’s possible to build something that drives nicely without them but there are enough places where variable have to be guesstimated already :smiley:
Challenger have a nice symmetrical wheel base with really cool hydro-pneumatic suspension, in principal it should drive like a cruise boat over the landscape. Do you have some reference materials for it? I wasn’t too keen to buy a 300$ book about tanks just to get gear box ratios for T-34.

Agree, I’m so used to it that I don’t notice it anymore. I’ll add some button to switch it on/off.

nice to see someone having a go at this, in my old life i used to fix things like that (Brittish) CVRT, FV430, though never did the chieften tank, i know the Challanger has a rollsroyce CV12 (v12) diesel but don’t know the specs for the drive train
that said the FV430 series has recently been upgraded with a new engine+drivetrain also the cvrt had a makeover but afaik was just an engine swap

but its nice to see someone who knows the difference between a normal turn and a neutral turn :slight_smile:

Thank you :slight_smile: I was thinking about which next vehicle to add, it was suppose to be Ripsaw, but I’ll look tomorrow if Ripsaw or Challenger have easily obtainable reference materials.
I want to look into M3 or M5 half-tracks as well, it will be a good exercise to decompose main blueprint into such pieces that treads and wheels could be used at the same time.

Updated link to a new version. Debug mode is switched off by default. Tweaked engine and friction parameters, overall should look cleaner.
The “proving grounds” on the map are actually build to test specifically M113 - 60% maximum slope, 1.7 meter wide trenches and some rocks to test 41 cm clearance.

Weren’t too happy about animating tracks with just a texture.
So far I found about 5 different types of tracks that can be installed on M113, I’m going to imitate specifically this one:

I want a higher level of detail for my project, so each tread have to be rendered as mesh:
What you see is only the central part of the tread, without rubber pad and pins which connect them to each other. Pins need to be done as a separate mesh as they have a different pivot and placed between tread pads.
The way it’s done right now is rather simple. I have a spline component which sets the path of the track in normal state, aka when tank is just resting on a flat terrain. As suspension starts to engage uneven surfaces I move points of the spline to follow wheels, automatically calculated tangents bend nicely bend spline.
The problem with this approach so far is that when spline points move, length of the spline starts to change which leads to shifting position of the tread meshes. So I need to somehow keep length of the spline around some predefined value.
One of the solutions to this is to place a spring on the idler (top wheel at the back) and compress it in proportion to (target spline length - current spline length). This means that if I link one of the spline points to idler, track should follow it and compress/decompress to keep it’s target length. Unfortunately, M113 doesn’t have a spring on the idler in real life :smiley: There are some tanks that could use that, but there are plenty which don’t rely on such setup. So I need some other solution. The only workaround I can think so far is to selectively scale tangents on spline points to make track path less curvy, but I don’t think it would be enough to compensate all the stretching that track gets even from a single wheel:

amazing what your doing here, but isn’t it a little to much for game content, i can understand it if your trying for a full tank sim but not sure if the computers/engine could handel all the info/anim date that is required if you have multiple tanks driving together.
just a little something to keep in mind.

btw the rear idler wheel is used to tention the track but rarely dynamicly , also not sure if that type of ‘tank’ has top rollers for the tread, i think the russian tanks have what you show but not sure

Thank you! It might be a bit too much. The vehicle that I want to build would be an up-scaled version of Vityaz DT-30 (youtube video in first post), with drive wheels of about 1 meter in diameter or bigger. So when you stand next to it in first person, details of the tracks would be quite visible. For the LODs it should be easy to fall back to animated texture on skinned mesh and I can do it even for “hero” tank when speed of the track is just too large to distinguish separate links.

Ohh, now I see that I’ve missed one detail - track elements are Instanced Static Meshes, they should render rather fast and performance hit comes from updating instances with new transform each frame. Which again can be done less frequent with the distance.

I’ve seen one drawing of M133 with top rollers but not a single photo with such setup, most likely it was just a mistake. Tanks with Christie suspension, like T-34 didn’t had rollers, most likely because amplitude of how far up/down wheel could move was so large that wheel could hit top roller.
You are right, it shouldn’t be dynamic on M113, I could make a dynamic idler for something like Ripsaw spring loaded wheel. But M113 and plenty of other tanks need different solution.

P.S. Battlefield 4 got away with so many simplifications, like here wheels are not even connected to axle of torsion bar :smiley:

But I’m just being picky, didn’t noticed this before at all.

yep there’s lots more to tracked vehicles than most people realise, but it does sound like you know what your doing so go for it , i admit it can be hard to find details on these vehicles as a lot of even older ones are still in service around the world

It took about dozens of links to find a data on diameter of sprocket for metal tracks on M113. Fortunately I found a post on scale models forum, where guy just went to garage and measured it on real machine :smiley:

Another issue I have is really weird one, somehow I can’t match speed of tread to speed of sprocket. This is like a basic physics.

  1. Calculate angular velocity of sprocket in radians, this comes from engine and other factors which influence tracks
  2. Turn it into degrees, multiply by DeltaT and call Add Local Rotation on sprocket mesh
  3. Then “sprocket angular velocity * sprocket radius” should be the linear velocity of the track. Radius can be scaled by few centimeters as tread is not placed on edge of sprocket. But anyway the result is not even close to what is expected. I was able to somewhat match the speed only when I assume that sprocket radius is about twice as small.

“W” is axle angular velocity
“AddLocalRotation( RadiansToDegree(W) )” is animation of sprocket
“W * SprocketRadius” is linear velocity of track.
But this doesn’t match visually,
" W * SprocketRadius * 1/2" somewhat matches it but not exactly, which doesn’t make sense.

not sure where i can help on this but be carefull with the calculations, as my teacher told me many years ago , when vehicle moves at 50km the track on the ground it moves at 0km and the track above the wheel moves at 100km
this sounds wierd but is relative to the ground and not to the vectors involved.

now we know that the track can’t stretch so thats set, using radians makes it even harder which i thought had been removed from ue, tbh my maths isn’t that good anymore

New version is up. Tracks are now done as an array of instanced static meshes. Spline animation still need some work but I think it’s possible to get a decent results with such approach:

  • Fixed issue with double speed - function which animate tracks was called twice :smiley:
  • Added reaction force from suspension, now it affects other objects in scene. You can use ramp to drop on top of the truck and carriage or a platform, placed over two M113s. Boulders react to suspension too, but it’s all very glitch at the moment as suspension reacts instantly.
  • Track configuration is different from what I wanted to implement, but this one requires twice less track parts to animate.
  • There is annoying issue with animation. As length of the spline changes tracks are moving to accommodate new length. But I have some ideas on how to fix it.

thats is looking amazing, i’ll be very honest that i wouldn’t even think about trying it

Thank you!
Tracks animation needs an overhaul to support more correct collision. But it would be awkward to do it in blueprints, I’ll see how it goes with C++ implementation. One approach is to build a specialized version of rope, with a set of box collisions, seams to be a typical approach in state of the art demos. Another approach is to keep using spline but iteratively conform it to landscape and rollers. Later should have a better performance and LOD scalability.

Maybe it’s better to move this thread to “Work In Progress” section? I’m not sure if this is a right place for it. Could you please do it for me, Geodav?

These guys made an amazing job in how tracks are animated:

When used together with deformable landscape, you can see how tread links between wheels are a bit higher as they don’t compress soil as much as ones under the roll wheels.

moved thread on request of author :slight_smile:

watched a bit of the video, while it looks good for a game just doesn’t look quite right, i know i’m being picky, i think its just not that easy to get right (uncanny valley) the closer you get the more the eye spots thats something is missing, i think in the animation world they now talk about secondary motion or noise motion, in the case of the track it just sticks to the road wheels and there is no sepperate bounce to the track link sections , i realise thats a bit much

I think I know what you mean. The best I’ve seen so far, as a tech demo, is this implementation:

Judging from bits of description and some other videos, tracks are simulated kind of like a stiff rope, with a box collider on each link element. At about 2:00 you can see how all track links are affected by gravity.
In principal, I understand how rope/cable can be coded to physically interact with other objects. What I’m not sure is how I would actually spin it by the sprocket. At least 4 teeth of the sprocket would push/pull the track.
The other aspect is translating all this into actual movement of the vehicle. In my case wheels are constricted by landscape only, they don’t care about tracks. In rope-track case, wheels have to be constricted by track, so traction-friction calculation have to be moved to track patches and then I have no clue how I can calculate wheel load on track element. Right now these calculations are done on 10 road wheels, each has it’s own suspension and that’s my “wheel load” force. For tracks I would need to somehow distribute vehicle mass and acceleration around contact points of track and take into account cases when there is no suspension force in place, for example if track link is pushed against obstacle by idler or a sprocket.

Precision of calculation is still to be desired. If I switch to C++ implementation would it be possible to run my logic with the same frequency as Physics runs it’s update cycle?

now that does look good, my only comment is that the links look a bit floppy, but it even looks right when turning in that the track below the front wheel is pushed out.

i’ve no idea if moving to C++ would help as i’m hopeless with that sort of thing, if what you have is all in blueprints then i’m totally gobsmaked

Yes, it’s done purely in blueprints right now and only with some basic optimization. I should take out some of the functions from calling every tick and call them with custom events instead. Math expression node seams to be more stable now, should use it more often.

Keen to watch this mature as will need tracked vehicles in my game.
Best regards and thanks for your efforts.