Is there any way to control order of actor processing in the physics simulation?

We can use tick groups and prerequisites to control the order in which game actors run their per frame logic. However, it is not clear what order actors/objects are processed by the physics simulation. Do they process in an order in which we have any control?

Along with this, is there any way to get a callback when an actor / component has finished its physics simulation for that particular sub step / frame? And I mean from within the physics simulation, not afterwards as results are producing notifications. I know we can register for and get event callbacks from PhysX when an object collides with another, or wakes up or goes to sleep - but what about just when they have finished their simulation step?

Thanks!

Why do you care about the order the physics sim processes items? Curious what you’re trying to do.

Stock UE4 has the FBodyInstance::AddCustomPhysics() which will call your delegate just before simulate() (not sure but you might have to have substepping enabled). Kinda weird though, you have to continually call it every game frame as the callbacks are cleared once all substeps have finished. To your question, no, there is no post-step or post-all-steps callback.

I have modified the engine to add those callbacks myself which I needed for doing fixed timestep. So you’d have to manually add them. Not too difficult, most code goes in PhysSubstepTasks.cpp and PhysScene.cpp. Have to be a little careful in what you’re doing inside the callbacks as they’re likely not running on the main thread, although I think they still can, just depends on how the task graph gets processed and which threads were available at the time.

You can set the ‘tick group’ on Actors, Pre Physics, During Physics, Post Physics, Post Update Work…may be helpful?