Found a better way to do this. Had to scrap the Vigilante’s way of track movement and used a Panner node in the material. Adjusted my tick code likewise.
You might need to extend the material to have its UV scale taken into account if you have vehicles with scaled up/down track textures and you probably need to get the wheel speed more precisely and get rid of the branch to avoid the slipping but other than that - it seems pretty much on point.
S is the speed of the vehicle forward in units per second
R is the current turning speed in radians per second (if you have it in degrees just use this formula rad = deg * π / 180)
d is the distance between the track and the center line of the vehicle or half the distance between the two tracks in units
This will give you the absolute speed of the tracks in units per second. Which one is + and which one is - depends on which direction R is positive and when it’s negative.
Now once you get the speed of the track and how big your texture is in real units you can make the track texture move with exactly the correct speed.
Now the wheel turns like so: WV = LTV / r
where:
WV is the wheel velocity in radians per second (you can divide by 2π to get rounds per second)
LTV is the velocity of the track in units per second
r is the radius of the wheel in units
These are independent of the position of the wheel but are different for each wheel size and each track. (as the tracks move independently from each other when turning)
I hope this helps.
PS. A small correction - in the diagram (and in real life) the tracks should move in the opposite direction of the direction of travel so probably you have to use -S… Still it should give you enough insight on how to calculate it.
So I was unable to implement this not due to any flaw in the method, but because of a little quirk of the panner node in materials. Apparently, whenever you set a new speed value on it, the panner resets and starts over with the new speed. That’s what was responsible for the jittery track movement and the fact that I was simply unable to control the track speed. Instead of using the panner, I fell back to using Vigilante’s original method of manually adjusting the V offset of the track texture coordinates.
I had to do this on tick though. Slowed it down to 0.05. I used a timeline to control the track speed over time and simply modified the play rate of the timeline by mapping the play rate to the dot product of linear velocity of the root component and its forward vector, which I also used to check if the vehicle is going forward or backwards. Do Once is there to not override the timeline when its running, otherwise, the timeline keeps getting reset.