Adventures in UE5 vehicle land

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:

v=Y08MUkRXayI

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

v=KJ_42Ob-7gM

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)

2 Likes