Truck with trailer - Trailer wheels not responding to surface

Hi there!

I’m having issues getting my truck with trailer setup to work correctly. It seems not matter how I set it up, the wheels on the trailer don’t react correctly with any surfaces. I’ve currently resorted to making the physics body of the trailer larger to stop the wheels from clipping, but they still don’t spin / respond as they should.

I’ve also tried creating them as individual vehicle pawn assets and joining them together with a physics constraint, but that still didn’t work. Looking for suggestions!

Thanks!



First of all, you never want physics to actually get wheels to spin because it will only cause visual artifacts.
Create a material shader for the wheels or lift it off the content examples to simulate the spin. It uses the vehicle speed within the material, and even provides a superior version of radial blur.

Secondly, is the mesh one pice or several pieces?

If you want the vehicle to respond naturally, you’d have to create a vehicle with every piece that has 4 sets of wheels.

In your case i suppose thats 8 for the back and 6 for the front, either way you would need two tethered vehicles for the second part to respond naturally to terrain without the middle tires clipping into the ground.

As you may or may not know, attaching 2 cars to one another and dragging will cause issues and artifacts of all sorts using either physX or Chaos.

More often than not, you just create your own C++ system to bypass those issues. NOT Simulating is a sure bet against having simulation artifacts.

If you want to put the time into that, you trace the wheel socket up and down to be able to detect terrain/mesh hits, and you offset the vehicle center axis based on the results of all 4 corner (or wheel positions).
I’m sure you can find tutorials on how its done matematically.

Once you got that set up, you want to move the trace forward to the position of the next frame - to do so, you offset the trace by the vehicle speed * delta time (for a rough approximation).
The speed value may need converting futher if its not already in 1uu (one unreal unit) to seconds.

You always trace ahead, so that by the time the code runs and updates the visual position of things you have the value of the next trace, and the already adjusted animation.

I would suggest not bothering with more complex (shock absorber) setups. On dragged things, same for carts.
Chances are you wouldn’t be able to tell the difference anyway at runtime, so unless its a specific requirement I wouldn’t bother.

If you want to gamble away and try the physics stuff. Just set up separate mesh.

To make things easier I’d only use 4 wheels anyway - the extra wheels can be present but unused by the system.

To do that, place a wheel of the same diameter at the center of the 2 visual wheels.
Assuming you don’t allow it to spin, you may even be able to attach the 2 wheels as a single wheel to have it respond along with the advanced vehicle shock setup.

To go more realistic here, youd have to make each 4 wheel set its own vehicle - and then code up how to attach and adjust the container on top.
Now, if 1 thing being dragged is bad, you can just imagine how 3 things being dragged would screw up your simulations… but hey, to each its own.

Thanks for your response!

I have tried creating them as 2 tethered vehicles (2 separate wheeled vehicles pawns) , but it still wasn’t acting as I would have imagined. The reason for trying to get it to behave realistically is to simulate vehicle swept paths, I figured that by building the rig correctly would help me achieve this.

I wasn’t aware of this sadly! Nor that Chaos only currently supported 4 wheeled vehicles, which poses me quite the problem for my project! Maybe using the fake wheels could be the solution for now, I just worry if I can get the accuracy / realism I require for the simulator!