The Problem With Tank Tracks in Unity 3D Built Using Blender Curve Modifier
It seems that Unity doesn’t support functions from Blender’s (perhaps any other 3D apps as well) curve modifier. A few nights ago, I had spent a number of hours perfecting the tracking for a tank that I’m working on for my Super Space Trooper video game. In Blender, the curve modifier made it really easy to animate the tracks by simply moving the parent object. Once imported in to Unity I discovered there was no way to do the same thing. So within Blender I created an animation clip of the tank moving, which would cause the tracks to move appropriately as well. Unfortunately that also didn’t work in Unity.
After some research I came to the conclusion that Unity simply doesn’t support these types of modifier functions.
Alternative Way to Animating Tank Tracks Within Unity 3D
So as an alternative way of doing it, I’ve decided to instead code the tracks so that they do the same thing. How will I do that? My thinking is this:
- Get the location of each individual track (tread?) piece of each track and put their locations into an array
- Assign the current position as the “start position”
- Get the location of the next item in the array
- Assign the next item to the “end position”
- Lerp between start position and end position over X amount of time
- Assign the end position as the new start position and go through #3 to #6 again
It sounds simple enough but I have been struggling with this now for 3 days. As a matter of fact, I pulled an all-nighter working on it and went to work after that, something I haven’t done since my twenties.
Once I have this code complete, and assuming it works well, I plan to release it on this blog so watch out for that.
Created tank tracks in Unity in the past? How have you achieved your results? Leave a comment.