How do I best handle interpolating movements of renderable objects? #8923
Unanswered
Architector4
asked this question in
Q&A
Replies: 1 comment 3 replies
-
The way that I would naively do it would be to have a new component that represents the real, uninterpolated position that game logic interacts with directly, and a system that runs after all game logic but before rendering that interpolates the custom component's values onto the real Transform component every frame. I think this would work well because systems that want interpolation can opt into it, the system can query for entities with the component instead of iterating the world manually, and no extra logic needs to be added to any system that wants interpolation. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say that I have a system (a physics engine or whatnot else) that updates Transform component's values of certain entities once every fixed timestep moment (for example 10 times a second, way lower than the usual framerate), and I want to represent those entities in the game's visible space, with meshes for example.
Obviously, doing it the most naive way of slapping
PbrBundle
on such an object will make it look choppy, as with the entity moves the mesh, 10 times a second. I want to render it in a way that looks smooth, somehow interpolate between the different Transform values for each rendered frame on the window, but in a way that will not disturb the original system at all, ensuring that every time it runs the Transform value is exactly the same as what it left it at the last time.Also, I intend to use multiple systems that would run at a single fixed timestep at once, not just one.
Any suggestions on how to best approach this? My first three thoughts are:
PbrBundle
and stuff) and systems which have just the interpolation logic in them. Sounds a bit cumbersome, but I think it has a nifty bonus: it sounds like it'd be easier to store the data the systems change in separate components, then run all the systems again on the spot, and get one frame of lookahead data that can be useful to perform better interpolation, and then use the stored data to revert it back.This post has been a bit of a braindump and I guess it might not make much sense at times. Thoughts on any of this?
Beta Was this translation helpful? Give feedback.
All reactions