Worst Tank Tracks (Need better ones)


I am working on a tank game atm and I made some tracks for the tank. In my case I just want the tracks to rotate in circle (like wheels), so basically no suspension, no real tank wheels, simply not a real vehicle.

I made my own tank tracks using no tutorials. It works, but if I look at the code it looks bad and it is definitely not how it should be done. I can feel that it kinda hurts my game performance. Probably because of many meshes or the way the single track components rotate.

Here is the way I did it:

this is how the track looks like

I have a spline with a bunch of splinepoints and on the splinepoints I spawn a mesh and save each mesh in an array

Each track has its neighbor. So Track with index 0 has neighbor with index 1, Track with index 1 has neighbor with index 2 and so on. But Track with last index has neighbor with index 0.

Now I take Track Index N and move it overtime to the transform of its neighbor.

Now thats where it gets weird. I do it with all Tracks.

It doesnt work in for loop. Loop doesnt support OverTime functions. Nothing happens if I do it in a for loop.

Now when I press A or D a message is sent to the Tracks BP where a timer starts and loops until I release the button.

Here is video of Tracks in work.

I dont really like my solution. I think its bad and not efficient. Does anybody know how I can improve or do it otherwise? Maybe someone can recommend me a good and understanable YT video?

Thank you.

Wow. That’s pretty ambitious, actually making the tracks rotate; but it does look like a mess (in the code). :open_mouth:

The way most developers do it is just pan the texture coordinates on the track material.
So, what you need to do is:

  • Tear out your existing Blueprint code for the rotating track :frowning:
  • Take your tank tracks model, and make it a continuous belt as one static mesh.
  • Configure the UVs for the track/belt to be organized such that the belt goes in one piece from the top of the map to the bottom
  • Make a texture for the track/belt that makes it look like a track made of segments, instead of a belt.
  • In the material for the track, set up a system to pan the texture so that it looks like the tracks are moving.
  • Use material parameters to let the Blueprint control the speed and direction of the tracks motion.

It won’t technically be tracks, but it will be a much nicer solution, and it should look convincing. Normal maps will make it look a lot better, and you could consider using “World Position Offset” to make to look the best.

Hope this helps!

1 Like