Introduction
I recently wrote up a private message to another DevForum user that contained basically this same tutorial about how to make working vehicle tracks (think like on a tank) that deform with terrain. I thought I would publicly share it here too since I’ve only seen a few other people do it. The method I’m about to share should end up looking like the tracks in Armored Patrol. There are probably multiple ways to go about doing this, but this is what works for me.
Suspension Setup
The first thing you need to get right is to set up the suspension for the wheels in the correct way. Here’s a really bad diagram of how mine looks:
If you need more help with that, I modeled it after the cars in this thread: [Update] Constraint Chassis
After you have the suspension working correctly and the vehicle can drive on its own, it’s time to connect the tracks. The tracks have collisions turned off. Here’s a picture of mine:
Track Setup
To achieve the effect, the tracks are not linked directly to each other with hinges. Between each segment are parts, which are connected to the tracks with hinges. I’ll be calling these parts ‘inbetween parts’ for the remainder of this thread. It’s hard to put in words, so it’s easier to show with another poorly drawn diagram:
You’ll need an intersection of tracks for each interior wheel of the vehicle. This is so that an inbetween part can be directly under each axle. In my case, my vehicle only has 3 wheels so I only needed 2 track segments and 3 inbetween parts.
Linking to Suspension
Once you get the tracks set up, it’s time to attach them to the vehicle and make them actually deform. The best way that I found without any scripting is to use an AlignPosition
and AlignOrientation
constraint with RigidityEnabled
set to true.
Attachment0 of each should be set to an attachment in the middle of the inbetween part, and Attachment1 should be set to an attachment on the axle part. This can also be kind of hard to visualize with just text, so here’s yet another poorly drawn diagram:
The blue dots represent the positions of the attachments. Basically, the Axle part has an attachment that has a position offset such that it’s in the same WorldPosition as the attachment in its corresponding inbetween part. You’ll need an AlignPosition and AlignOrientation for each inbetween part, with Attachment0 of each set to the inbetween part’s attachment and Attachment1 set to the corresponding axle’s offsetted attachment.
Conclusion
If you set everything up correctly, you should be done! Here’s the end effect:
https://gyazo.com/991938d4d295c25d0217f08ebd45f2f4
I hope can help anyone who is looking to achieve this effect. It took a lot of testing and such to figure this out.
Disclaimer
This method is now slightly outdated. Mesh deformation in Roblox now allows for a more standard approach (at least in regards to how games in other engines do it). I have that working, and here’s what it looks like with a skinned mesh:
https://gyazo.com/22be2054baaa4d73999940de32feeab3
File
The included drive script is not good but it’s just meant to work, and it does. You’ll have to make your own script to actually drive the vehicle.
tankupdated.rbxm (15.3 KB)