[ASSETS] [OPEN SOURCE] Tanks, tracks and N-wheeled vehicles

btw @BoredEngineer , if you need help somewhere when you move a tank example to the new system let me know.
I have no idea if I can be of any help, but love to help you out where I can.

If you move a tank setup to the new system I will create a new setup video tutorial if you want.

I’m not sure if we ever talked about this.

But have you thought about multiuser environments? (Or multiplayer)

Is it possible to use this setup in a multiplayer environment? Or is that something that will only work better with the new system you are working on?
Or is it maybe to complex to be used in a multiplayer environment?

Thank you, Oldraven! I don’t know (yet) all the necessary changes to tanks under MMT but I’ll let you know if something needs to be updated in tutorial.

Regarding multiplayer, I didn’t looked into it yet but it shouldn’t be too different from other multiplayer physics based games. There are couple of posts here and there on how it can be done. Perhaps it’s a good idea to look at this rather earlier than later. But non-component based version most likely won’t support it.

I will definitely be exploring the multiplayer rout and vr as well . I’m super happy to help if any of you need anything!

Helping

I will definitely be exploring the multiplayer rout and vr as well . I’m super happy to help if any of you need anything!

What do you mean with non-component based? :smiley: excuse the dumb question if it is . :wink:

I have not looked into the performance much yet, I’m just curious if in the end the tank under MMT will be suitable to use in a multiplayer environment.
I will dive into the multiplayer part of UE4 soon as I got a request from a client involving multiplayer… and that for me is still abracadabra.

Thank you! As you can see already, the feedback on how things work and what is clear/not clear or hard to setup is very valuable. For me it’s difficult to test all aspects of the “simulation” especially with models that I haven’t made myself.
I need to add a lot of notes. Something like having a root body with its own collision, to get physics running, is rather a necessity. But if it’s not mentioned anywhere then you might not even know that it’s important. Now I know that this should be added as a note and explained in tutorial.

Non-component based is the current setup, where all implementation is in the single class. I don’t know how much work have to be done to make it work in multiplayer, but I know that it’s rather time consuming to refactor that code. Right now, I’m using component based approach to build a hovercraft and it’s much easier to manage complexity and dependency of the code.

Performance wise, some parts should be moved to c++, but it’s really easy to do on per component basis. Meanwhile blueprint’s performance can get a significant boost with some of the next updates.

Hi BoredEngineer,
first of all thanks for your project, its impressive work. Im trying to recreate Leopard 2 MBT and Im having issue with treads - its bit similar to silverwolfes issue with Centurion wheels: followed by OldRavens video and everything was fine until I created treads. In blueprint editor everything looked good:

But in game treads looked quite strange:

When I moved treads, splines etc. to “base” position (like in M113) and in editor it looked like this:

And in game…:

I read about moving pivot to the center of wheels - so I did, but without effect, treads still are broken. I tried to modify AnimateTreadsSplinecontrolPoints function, but best effect I`ve achieved looked like this:
7112cbab1a7f5a39a840701917ca08dd1b0714fb.jpeg

Of course this ruined treads in all other vehicles:
treads4.jpg

I tried to edit other functions, but effects were too messy to show - right now I must admit I`m out of ideas how to set up these treads properly :confused:
Will be grateful for any suggestions or clues.

every cv in the curve for the thread has an x y and z coordinate. It’s looks like they are not all the same in the horizontal plane… it sure is a pivot or coordinate misalignment… now to find out which one.

I’ll check with the tiger , I had the same thing when setting it up.

Or it could also be a tangent problem… you need as many tangents for the curve as you have points on the curve

This is the issue with the pivot location of the wheels and sprocket. When I was building M113 I didn’t thought about cases when sprocket, idler and road wheel pivots can have different Y coordinate. If you open sprocket and wheel mesh you will see that they have a pivot exactly at their center. Inside of the BP they are aligned as well - they have the same Y coordinate, as far as I remember. Spline control points use X and Y coordinate of the wheels, sprocket and idler to position themselves, which is wrong and should be fixed, but this is just how it is right now.
Anyway, as a temporary fix. You can change pivots of the wheels and sprockets in your model, in modelling package. Decide where you want to have a center line of your track and then move pivots of wheels and sprocket to the center of this line. Like this for the left side of the tank:

So all pivot points should be on the same line. Then re-import meshes and move them around, if their pivot points aligned then they will be on the same Y coordinate.

EDIT: The way tracks look in editor is misrepresentation as coordinates for spline points are read from the array. In real-time, spline control points are aligned with X and Y coordinate of the wheels, sprocket and idler.

yes now that you mention it…

I made sure my wheel pivot is in the exact center of the model, same for the sprocket and idler… but indeed when you look at it from the top view the center did not line up, so it is important that the pivots line up.

Still, looking at the images… I think the The spline coordinates do not match up.

-Open the spline coordinates array (R and L) in your blueprint and check if the Y coordinates all have the same value… they should.
-Check how many elements the array has (in my case 21), then look at the Tangents spline array and check if it has the same number of elements… it should…

Thanks for your replies, Ive changed pivots for wheels, idlers and sprockets (now pivots are in line: -154 for left and 154 for right) and checked suspension arrays (Y coords have the same values), made sure that tangents array has the same number of elements (in my case 19), but no effect :/ However, Ive noticed something - when I`ve moved suspension handlers towards center result was like this - treads were OK, but wheels…:
d66ee77634bcec5fd313f31fdf39e9331e4a6636.jpeg

And when I`ve moved suspension handlers back to wheels:
6859d978d4fb07e7b739a58dd17d14a5cd0af5d7.jpeg

Maybe I`m wrong, but it looks like treads shape is connected with suspension handlers, just like wheels?

Are all the Y values of the wheels, suspension handle, idler AND sprocket the same? (for one side, for example the Right side)

Wheels follow suspension handles :smiley: I know it’s a mess of dependency. OldRaven is right you need to place suspension handles where you want your wheels to be. Can you open your wheel in asset browser and take a screenshot such that we can see the grid and center of the wheel?

Another thing to check is parenting, in M113 everything is parented to the root body there is not other hierarchy, if you have any like a scene component to move all wheels at the same time, it might effect it as well.

Here`s wheel wireframe screenshot:
tread_wheel.jpg

I experimented with lot of setups and something quite unexpected happened - when I placed wheels, sprockets, idlers and suspension handlers in line and edited suspension array I achieved this:
47d507e7250b3211c5cb8f45002b9b8dcf98bf83.jpeg

This gave me idea - I`ve edited in array all spline nodes without suspension handler (near sprocket and idler), what in editor looked like this:
47d507e7250b3211c5cb8f45002b9b8dcf98bf83.jpeg

But in game…:
0b7f38cddfc970829cc45772ef9adaabafdc15b6.jpeg

Looks fine and behaves properly, but for me it looks like placeholder :slight_smile:
Sorry for messed pictures, my bad.

So wheels are on the line with spline (blue line I guess), is it the same for the sprocket and idler?

Ok I need to fix this mess. The idea would be to govern XY position of spline by it’s relative coordinates to the root body, so their Y coordinate in array would be 0, which mean a single array could be used for both sides. I’ll take out all this horizontal alignment of the spline. Alignment of the wheel to suspension will stay for now, otherwise it distorts movement of the spring.

Fixed in the latest version. It’s on GitHub already. Just a simple test that it works:
ebb9eb6742cfc91da5c7e4f54c157d5581ed9d75.jpeg

Y coordinates for spline control points is read from array. The changes are in A_TrackedVehicle>AnimateTreadsSplineControlPoints and they look like this:
a0b26913e447f8be784e43d414df6689270d063c.jpeg
So one can fix it locally without syncing with source.

Wheels are still following suspension handle so you can do things like set suspension Y rotation to 30 degrees, then spring will be pushing wheel diagonally instead only vertically. This is the point where X coordinate of spline control point can dynamically change, so only Y coordinate is fetched from the array. Originally Y coordinate was read from the wheel, so that you can rotate suspension in two axis, if you want to setup it as V shaped with some degree of chamber. But it’s easy to change to such behavior by connecting wires in the function above.

In case someone missed it. Tracked vehicles were ported into Machinery Modelling Toolkit:

Further development will happen there. First priority for tracked vehicles is to get them working with physics sub-stepping and then split into components.

Yes, and in case some missed it over there… I will be moving my CV90 and Tiger example to MMT also.

And when the tracked vehicle components are integrated or added to MMT I will do a revision if needed of the video tutorials on setting up a tracked vehicle.