[OPEN-SOURCE] Machinery Modelling Toolkit

Two questions:

  • Are you using Nvidia Physx ? If no, you got plan to support ?
  • This support normal vehicles too of 4 wheels etc ?

I got the problem with the default Unreal Engine 4 support because I can’t change the vehicle engine or wheels parameters in-game, so here I can ?

It’s all UE4 build in physics, which means yes - it uses PhysX. I don’t have particular components which simulate wheel yet. Anisotropic friction component can be used to create simple wheel, but this might not simulate tire on the level of how PhysX vehicle does it. I’m planning to add similar component in the feature.
Here you can change as much as you want whenever you want. We can even expose SetMass and SetInertiaTensor to BP using plugin, it’s all custom made specifically so one could build anything they want :slight_smile:

you’re awesome! Keep up the goodwork!

Thank you!

I’ve tested manual brake steering, separately for left and right tracks. It’s too sensitive to steer this way and by holding brake for more than half a second you can send M113 into a spin, if sensitivity is lowered than it turns sluggishly. Maybe some nonlinear coefficient would help but I don’t think it is user friendly to have 4 button combinations just to turn left/right. Unless you are into building a simulator and want that kind of details.
The solution to easiness of control and no cheating physics is to use a dedicated PID controller which applies more brake power if we turn too slow and less if we turning with just right speed. The aggressiveness of steering is control by P coefficient of PID controller, tweak it to get a behavior that you like.
Fresh version is uploaded to GitHub and latest executable is as always by this link: https://www.dropbox.com/s/55dazkm8q4s0axn/MMT_Content.zip?dl=0

I only just got this notification so I wanted to thank you for taking the time to respond!

Your answers are clear and make sense, I agree it gets really tricky when functionality spreads its dependency across c++ and BP - I really with BPs were just visual code in the sense that migration is easier as per c++.

Update

Aerosled RF-8 is back!

compiled version:
[MMT Content Compiled]](Dropbox - File Deleted)

Ski friction is simulated using special new component. Later I’ll build ski component in more generic way, right now it uses 3 equally spaced points on the mesh to simulate friction. Aerosled has angled suspension (springs are pushing on ski and chassis diagonally, not purely vertically) and at low velocities this creates a bit of a side movement, which friction tries to fight, which pushes sled sideways, which engages suspension, which creates side movement… so we get a viscous cycle and wobbling machine when it is suppose to be standing stationary. This is “fixed” by enabling custom friction only if velocity is high enough (arbitrary value like 20 cm/s) and relying on PhysX friction to handle everything at low velocity. To my surprise, this works really well. The only downside is that you have to match your friction coefficients in physics material and custom friction component. Still, this is much better solution than previous one which used no-friction physics material for ski and relied completely on custom friction.
This machine is peculiar in a way of how important is airdrag for this machine to work properly. Most of the time, the role of airdrag is more of a force limiting your top speed or adding nice curve to a ballistic trajectory. In case of this machine, airdrag on radiator grid of the engine, works as a lever which stabilizes machine and removes part of the load from front ski at high velocity, this makes steering at high speed less sensitive.

I’m planning to add some generic component which can be used to flip machines on the wheels/ski/tracks if they landed upside-down. Something akin to how it is done in GTA5, where car will try to flip over automatically if it stay on the roof for more than few seconds.

Awesome, each day is looking better and better.

Can you add an example of a 4 wheels vehicle (car), and 2 wheels one (motorbike) ? To get a clear idea ?
And if is possible in each vehicle 2 profiles (to simulate for example the customization in realtime in game) as friction changes etc ?

Well, the funny thing is most likely I’ll add airplane parts before I get to the car wheels :slight_smile:
I need to find some good and simple way for you guys to be able to tweak parameters of tires without looking for reference on 20+ tire parameters that racing sims use. I’ve talked with 0lento about this recently and we got some good ideas how it could be implemented. So car wheels will be added. Bike wheels is a bit of a different beast. Proper, bike wheel can be steered by tilting it, it should be possible to simulate such behavior but I don’t know if we have enough precision for this. Worst case scenario, such behavior could be modeled on the level of the bike itself.
A simple example of changing parameters on fly is braking mechanics on Aerosled. In real vehicle, back ski have metal pins which are pushed into the ground when driver presses on brakes. Here, I simulate such braking by changing friction coefficients of back ski when brakes are pressed. Btw, this reminds me that only central point should change coefficients, not all three contact points.

I understand that cars is perhaps the most popular subject in vehicles simulation. Unfortunately they are the hardest machines to simulate in real-time. I don’t want to build a sub-par solution for them, at the same time I’m not sure if I have enough time and experience to figure out all important aspects of their simulation. Step by step, bit by bit, we will get there. Tire and wheel simulation first, then steering links, anti-roll bars and etc.

Love the plane example on your youtube channel! :smiley:

Thank you! Recording came out really bad for some reason. I want to polish it a bit in regards to controls and upload fresh version to repo.

Update

For this updated I’ve added a very simple simulation of airfoil. Most of the code was written back in 2014 and now it’s moved into component. Airfoils can be used for simulation of spoilers on cars or rudder on hovercraft. They can be used for rudimentary wings too. The model itself is a bit too simple to be used in flight sim, but it can provide some sort of semi-realistic behavior of flight.
A bit of a silly example is Aerosled which can fly:

It’s not a good airplane in terms of flight characteristic, but still took about 3 hours in total to tweak size and location for wings and control surfaces.
Here are videos from different iterations of trying to get it into air.
First successful take-off:

This version is a next iteration which can be steered (my apologies for video quality):

I don’t have a video of latest version but it has a smoother controls, variable engine throttle and more informative GUI. Steering of the aircraft is done by actual rotation of the control surfaces, there no hacks like adding torque to the chassis to pitch airplane. Behavior is driven by lift and drag force generated by airfoil components facing incoming airflow.

Uploaded fresh version of the source to repo. Fresh executable is, as always, here: Dropbox - File Deleted

Update

Fokker Dr.I joins the rank of the MMT machines:

3D model and texture is made by my friend. This is the same aircraft that Manfred von Richthofen “Red Baron” was flying back in WW1. It’s an early WIP and many things have to be fixed and cleaned. It flies much better than Aerosled but a bit harder to get off the ground and land as it tends to roll over the wheels. These are my attempts in flying it and landing:

Compiled executable as always here:
https://www.dropbox.com/s/55dazkm8q4s0axn/MMT_Content.zip?dl=0

I’ll upload code to repo after it’s cleaned up.

Nice!

Somehow I never expected to see an aeroplane in the MMT… I have no idea why… but it makes absolute sense…

Thank you!
The original name that I liked more was Vehicle Modelling Toolkit, unfortunately “vehicle” is associated more with cars/automobiles than with generic machines meant for transportation, so I went with “Machinery” instead. But I digress.

Airplane is more of a side product from adding simple airfoil model necessary for aerodynamics of rudders and spoilers. I have a better model in works, which would be more realistic for the full wing simulation. It’s suppose to be generic enough to get semi-realistic simulation and be able to simulate anything from soaring airplanes to jet powered flying wing. If it’s good enough, then one could “design” their own flying tanks or ultra light crafts.
Just imagine getting a general look of the machine not from the artist sketch but from functional design - aka how most of the machines are build in the real world. Let’s say you want to build a game with various war machines on some alien planet. You can have different athmosphere, gravity, landscape, soil composition and available fuel. All these aspects provide you some basic variables against which you have to design your machines. This way your machines will naturally look different from what we have here on earth and its design will make sense. Something like this was done in Avatar movie - they tried to design their machines in a way that makes sense. I think it’s a great approach and provides good base shape of the vehicle.

Wow man this is nice, so you added the airplane component from the last 2 post in the repo ?

Not exactly airplane component, more of a “wing” component. In the video you can see blue and red vectors originating from several points over the wings and tail. Those are produced by individual airfoil components. The airplane itself is assambled from parts, each wing, rudder, ailerons and elevators are individual static meshes components. Airfoil components are attached to these meshes, so in principal you can break them in mid flight and airplane will react accordingly. Simulation itself is rather simplistic and is fine for arcade semi-realistic flight simulation. I have a better model in works which should provide more realistic and interesting results.
Airfoil component itself is almost exactly the same as current public repo version (component used for flying aerosled), I need to fix couple of things in local version and then it’s ready for the public access.

Oh cool just waiting to see the binary demo content of the airplane in the repo ^^

Update

Added new component which is capable of more accurate simulation of the wing. In new implementation, control surfaces are simulated as a part of the wing and modify its aerodynamic properties, instead of being separate smaller “wings”. Flight model became more interesting in handling and there is more variety in how airplane reacts to steering. Wings are now separate physics bodies and attached to the fuselage using physics constraints. Lift and drag forces are applied directly on wings, not on fuselage, this should make it possible to “loose” wings because of too much force or flex them during flight. Braking of the wings is not implemented in current version, on Fokker DR1 it should be relatively easy to setup by enabling “breakable” on physics constraints that holds wings.

For now, only rectangular wings without tapper and sweep are supported. I’m planning to add parameters and functions to support more variety of wing shapes in feature.

Latest version is uploaded to GitHub: https://github.com//MMT_Content
and latest executable is here: Dropbox - File Deleted - Simplify your life

Known bugs:
Doing barrel roll on flying Aerosled can glitch out when machine is upside-down. Most likely related to how suspension works.

Edit: This is still for version 10.4. I’ll make a separate branch to keep this version before switching to 4.11

Update to 4.11

Both plugin and content github repositories are upgraded to 4.11
In case you still need 4.10, compatible versions are saved in separate branches, called 4.10

Enjoy all new features of 4.11!

Checked it out very briefly and it’s some of the most impressive stuff I’ve seen thus far for UE4 in terms of vehicles. I’ll be playing around with it a bit, that’s for sure. I’m curious about changing the controls however to use a 360 pad so each stick would control each track to sort of simulate how you drove tanks back in the days.

Is this doable through BP, or? I looked at the M113 and Ripsaw BP but I didn’t find anything in them controlling the movement - or maybe I’m just overlooking it since it’s rather late and my brain juice is running low. :rolleyes:

This opens a lot of doors for what can be done with UE4 without any extensive C++ knowledge, great work!