Download

Adventures in UE5 vehicle land

If there’s a better place for this let me know…

I’ll be trying to implement a few vehicle types derived as much as possible from UE4 version I have, and give as much feedback as possible here.

The first up is a plane sim and a fly through of my ue5 mapping experiment. I’ll reply later a write up of the technical issues, etc…

4 Likes

A plane sim was pretty straight forward in UE4 using a simple vehicle sim for the plane’s wheels. Since there is no chaos version of physx’s simple vehicle it’s not surprising there are issues… hopefully they will implement some version of that in the future.

Wheels aside, a lot of it pretty much carried straight over. Physics asset, animation bp and all seemed pretty much unchanged.

Issues:

Wheels: Right now the only chaos wheeled vehicle sim requires 4 wheels while we only want 3. Since the first two wheels are considered in the front I tried making the 2nd wheel use the same bone as the first one, to mirror turning and spinning animations and physics. For whatever reason the front wheel doesn’t turn with steering but it does roll just fine. I’ve also tried setting wheel 2 to the engines turbine bone which should be higher than the other wheels and solve some potential issues with it. It made it spin but didn’t fix any physics.

Center Of Mass: A big problem is that the COM adjustments don’t seem to work as expected.

This is with the mesh component’s Center Of Mass Offset (X=200,Y=0,Z=20). Since it’s wanting to do wheelies (pointing nose up) it seems the COM is too far back. As I move it up 250 units at a time, it gets a little better each time until it starts bouncing around. It seems there’s no way to get it to act right.

As far as I can tell this is the only COM setting that actually does anything but it doesn’t get the needed/expected results. There doesn’t seem to be many options left at this point in time, but I’m probably going to use the plane’s mesh for a car sim and see how far I can get.

2 Likes

This is exciting. Please keep going! You listing the gotchas is super revealing.

1 Like

yes its cool!

1 Like

4 wheeled vehicles using a subclass of UChaosWheeledVehicleMovementComponent:

A big problem is there’s some code that puts the vehicle to sleep. The vehicles seemed totally broken/frozen before, but someone figured out they need to wake up the object when driving the vehicle. I have the wake up call in the vehicle’s tick to brute force it, but it doesn’t fix everything.

One case of freezing is when small forces are applied to it. I originally thought it was the final velocity that was the trigger to freeze it, but it doesn’t seem to be what’s happeneing in this particular case. I have 2 external forces that are always being applied, additional gravity and drag. When the sum of them is large (10k+ ?) the car remains unfrozen. With my current settings if I turn either one of them off then it starts freezing up. Keeping them both on and it’s fine.

This is with just the additional gravity and drag at zero:

Notice that it starts off falling but with the additional gravity force it kicks in the freezing which makes it fall very slow. It’s stuck in a semi-frozen mode and the wheels aren’t kicking it out for whatever reason (physics thread results irrelevant to the freezing at this point?). Using my custom boost (just a raw x+ force) is needed to push it over. Adding the boost and the additional gravity is large enough to keep it unfrozen.

And here it is behaving “normally” with my current settings that has them both on

Applying none of my custom forces makes it look like this too, of course.

Another thing I’m not sure about is that my custom forces are behing applied in the game thread (movement component’s tick). I’m pretty sure all of the other forces oocur in the physics thread, so it would be ideal to put them there. It would be nice if the physics sim code could be properly subclassed but protected members prevent this from working.

I’ve made sure GVehicleDebugParams.DisableVehicleSleep = true so it skips at least one check that can sleep it (checks the velocity against SleepThreshold and makes sure you’re not on a hill)

1 Like