I only have a little experience in 3D modeling with Zmodeler, I used to do mods for GTA IV and Euro Truck Simulator.
The most important thing right now is to get the physics as close to reality as possible. Everything that moves, twists, bends on a real truck needs to do it in my game.
I imported each part of the truck as a static mesh, I created a pawn and I assembled all the parts in UE4 using constraints.
Update
I finally got my truck moving and steering
Also the constraints are much more stable now, almost rock solid
I am extremely inexperienced so I might not explain this right.
I started by importing all the parts of my truck, wheels, axels, suspension parts, frame, cabin etc. as static meshes.
After import I double clicked on each static mesh and a window opened where I created collision for it.
I created a pawn, I double clicked on the pawn and a window opened.
I dragged all the parts of the truck in that window and arranged them so that everything was in his place and I checked the Simulate Physics box for each part.
After this I started to add physics constraints and I joined all the parts together.
Thank you for the reply Wheels look really stable, never happened to achieve this by myselfā¦
Mind sharing how you made the suspension? Couldnāt get constraint to behave as a springā¦
I did a similar setup for 10 wheeled truck and wheels kept going crazy at high speeds. The only thing that would make them stable is to completely remove their friction. Iāve decided to simulate friction myself but run into a problem of not being able to calculate wheel load because of this bug:
So Iāve ended up with simulating suspension manually as well.
More specifically the problem is that friction is applied to wheel and then propagates through chain of your constraints to the main body. For this to work correctly you need to scale the mass of connected objects in such a way that itās as close to 1:1 ratio as possible. One way is to fiddle not with mass but with āmass scaleā property. Unfortunately this leads to a setup where 30 ton truck has a 3 ton suspension axles connected to 3 ton wheels.
Duncan, there was a project you could download. which had the basics of this, but now it canāt be downloaded. this was the forum page. I downloaded it months back and learnāt how it was done, thanks to the publisher Polyplant all the credit for the tutorial project is to him. I have just uploaded the rar file to my mediafire account so you and others can download it. Also this project is for engine version 4.7
Thanks Sean. I remember reading that thread after the first post what it is now (nothing but pictures) so I was a bit confused as to what was going on. I will be downloading that sometime tomorrow, thank you.
Very nice! I like how most of the parts are connected to each other instead of being single solid body. The wheels are turning a little to fast, are you using SetAngularTarget of constraint for steering?
Btw, any tips on getting more stable constraints? From my last experiment with aerosled I got much more stable behavior by adding sockets and adding them to physics constrain parameters.
For the constraint stability one of the most important things were this settings on all the truck parts
And the Constraint Projection Values are set to 0.1 for the Projection Linear Tolerance and 1.0 for Projection Angular Tolerance
Another very important thing is Sub-Stepping. I set 16 steps and Max SubStep Delta Time to 0.016
Initially the Max SubStep Delta Time was set to **0.016667 **which was perfect at 120 FPS but when I dropped the frame rate to **60 FPS **the wheels were getting pushed into the ground and jumping around this problem got fixed by changing the Max SubStep Delta Time to 0.016
But now Iāve changed it a bit. When you enable ālimitedā on angular constraint, you can call āSetAngularTargetā in degrees for it. The nice thing is that you can change this target in real-time, so when I want to turn right I simply start to slowly increase target yaw degrees and constraint will just hold it in that position. Iāll post screenshot of blueprint when I get home, or you can grab a project from github repo GitHub - BoredEngineer/UE4_Tracked_Vehicles: Custom tracked vehicles for UE4, NOT based on PhysX Vehic, blueprint is called Aerosled.
These are really cool tutorials! Thank you for the link.
Iāve never seen such bug before. My guess is that you have a problem with one of the physics settings like āUpdatePhysicsVolumeā where it needs to keep recalculating some sort of bounding box, when you drive straight along one of the axis then bounding box keeps it shape. This is just a guess.
Do you have any other blueprint code there except for the steering?