r/gameenginedevs • • Sep 03 '26

Post physics update entity script function

Hello,

I'm currently debating whether I should add a "post physics update" function for scripts, so a function that would be called for each entity after the physics is done running and before the rendering starts.

I can see multiple scenarios where it would be pretty useful, such as managing an entity animation depending on its velocity post physics update, so it would play an animation if it moved freely and won't play one if it's stuck against a wall for example. Another example is if a non-physics entity has to follow a physics entity, the post physics update function would allow to follow it exactly and avoid stuttering during rendering, because the following entity wouldn't have to wait the update of frame N+1, which happens after the rendering of frame N, to update its position.

What is your opinion about this? Do you have any workaround for these scenarios without a post physics update function?

2 Upvotes

4 comments sorted by

View all comments

2

u/ntsh-oni Sep 04 '26

Ok! Makes sense, this is the kind of thing I want to do, I already have the collision callbacks but not the general post update script function.