i have been using constraint tracks and let the physics engine do it, but its always been laggy when theres too many of them and i wanted to recreate the tracks in MTC4 because of how
performant it is compared to the traditional constraint tracks
i believe they use mesh deformation and use bones to actually animate the tank treads
there this blog post but the tutorial is for unity, but i know i can use that and find a way to make it work on roblox.
any resources or help would really be appreciated!
there’s couple of ways you can make good looking tank tracks, sorted from the most performance effective down to the least
Use Beams, fold them into a 3D box… you can add textures and make it move!
Mesh Deformation Tank Tracks, this’ll be more of a pain to do especially if you’re planning to make multiple tanks… but, it works!
Use ALOT of math formulas, combine bezier curves and alot of other stuff… basically, animating and generating the Tank Tracks using purely math. This is what i did before, you can find the post. And, it’s great in performance. Ultimately, you can use ChatGPT to help you with it! Which i did, and it ended up working perfectly. Keep in mind though, you’ll need to be VERY DETAILED and SPECIFIC when you use ChatGPT! (like, specifically mention that it needs to be CFrame)
hey, i checked your post and its really cool. i am looking forward to recreate it!, any help from you would be amazing!.
I already begun with some simple track generation and updating
but i don’t know how do i get some curves on the idler and drive sprocket wheels
I am not really good at math and i have to rely on free resources very often
You’re doing amazing so far, and to make it curve, like i said! Use, bezier curves! Should be quite simple to learn in lua, and there’s alott of resources regarding that! When i have the time, I’ll check the script of my tank system and teach you^^
now i just need to find a way to have some parts moving, which i cant figure out how.
perhaps can you explain me how does your code move the parts?. thanks in advance
well tried that, seems to have no affect.
i tried with just
local new = CFrame.new((P1 + P2) / 2, endpos)
just have the part to look at the endpos and not have att1’s angle not affect it. it kind of works, but when i just roll it a little bit the treads does not follow
thats why i tried to have the treads copy the att1’s angle so that when it happens it follows along.
so i tried with CFrame.new((P1 + P2) / 2, endpos) * CFrame.Angles(att1.WorldCFrame:ToOrientation())
but that still does not work because if i try to rotate it, it does this
nvm i found the solution,
it was just local new = CFrame.lookAt(pos, P2, att1.WorldCFrame.UpVector)
just have it look at P2 and have it copy att1’s upvector if that what it supposed to do.
now i just need to find a way to actually move the treads or animate them
There are no bones or mesh deformation involved. It is actually seperate parts for all the track links, which are animated every frame. Lot of math involved to calculate the correct position and rotation for each track link. My implementation doesn’t have the best performance yet, still gotta work on that. What I did however was calculate the CFrames locally then transforming them to world CFrame using some anchor part in the tracks so rotation of tank is accounted for.
well i did it, i managed to make the tracks to move, all i did was lerp the tracks from att1 to the next att2 which is updated every frame after the list of points for the treads are updated, like this local cf = startingatt.WorldCFrame:Lerp(nextatt.WorldCFrame, offset)
and have the offset added every frame
offset += script.Speed.Value
if offset > 1 then
offset = 0
end
the code is very spaghetti but i’ll just clean it up later
now just 1 more to add which is to actually match up the speed of the tracks to studs per second (bascially the speed of the vehicle)
There are a few tanks with tracks in the toolbox. Reverse engineer a few and take a look at how that is done. I found 3 pretty good ways and picked the one I liked the best. After that I knew how to do this by heart. Mine used all motors and constraints, no code to it at all… other than motor speed.