{"id":15137867,"url":"https://github.com/janhohenheim/avian_interpolation","last_synced_at":"2025-10-23T13:30:57.247Z","repository":{"id":256070689,"uuid":"854256170","full_name":"janhohenheim/avian_interpolation","owner":"janhohenheim","description":"A general-purpose Transform interpolation plugin for fixed timesteps in Avian Physics for the Bevy engine.","archived":false,"fork":false,"pushed_at":"2024-09-20T08:37:47.000Z","size":4604,"stargazers_count":31,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T18:48:21.335Z","etag":null,"topics":["avian","bevy","bevy-engine","game-development","interpolation"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janhohenheim.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license-apache.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-08T19:29:03.000Z","updated_at":"2024-12-11T09:45:57.000Z","dependencies_parsed_at":"2024-09-12T03:19:31.367Z","dependency_job_id":null,"html_url":"https://github.com/janhohenheim/avian_interpolation","commit_stats":null,"previous_names":["janhohenheim/avian_interpolation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhohenheim%2Favian_interpolation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhohenheim%2Favian_interpolation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhohenheim%2Favian_interpolation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janhohenheim%2Favian_interpolation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janhohenheim","download_url":"https://codeload.github.com/janhohenheim/avian_interpolation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237834623,"owners_count":19373759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avian","bevy","bevy-engine","game-development","interpolation"],"created_at":"2024-09-26T07:03:00.242Z","updated_at":"2025-10-23T13:30:57.235Z","avatar_url":"https://github.com/janhohenheim.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003e [!IMPORTANT]  \n\u003e This plugin is no longer maintained. [`bevy_transform_interpolation`](https://github.com/Jondolf/bevy_transform_interpolation) now does everything this plugin\n\u003e used to do, and only costs a dozen or so MiB more RAM to run. In exchange, it works with non-avian types and has the brilliant quality of existing without me\n\u003e updating it. Nice! I advise you all to use it instead of this plugin :)\n\n# Avian Interpolation\n\nA general-purpose [`Transform`] interpolation plugin for fixed timesteps in [Avian Physics](https://github.com/Jondolf/avian/) for the [Bevy engine](https://bevyengine.org/).\n\n[`examples/split_screen_comparison.rs`]:\n\n\u003cvideo src=\"https://github.com/user-attachments/assets/919c4809-0502-4b37-b789-261b7e9c7c30\" width=\"50%\"\u003e\nA video showing the difference between enabled and disabled interpolation.\n\u003c/video\u003e\n\n*Note: The interpolation on the left is smoother in reality, blame the video recording software ;)*\n\n## Why do I need interpolation?\n\nEver had your character jitter around when making the camera follow them?\nThis plugin may be for you!\n\nFor a full explanation, see Bevy's [`physics_in_fixed_timestep`] example.\nThe short version is that on fast enough machines, your game will update its\nrendered frame more often than it will update its physics simulation.\nThis means that sometimes e.g. your camera will be moved around without any physics\nobjects being updated this frame. This will lead to the physics object's movement\nlooking chppy and jittery, like on the right window in the video above.\n\nThere are a number of ways in which we can deal with this, and the easiest is\ninterpolation. By letting the visuals of the physics objects intentionally lag\na tiiiiiny bit behind, we can smoothly interpolate between the last two values, leading\nto smooth and correct visuals, at the cost of the rendered objects\nbeing behind the underlying physics objects by a bit. How much?\nWell, long story short, expect the physics to be ahead of the graphics by a single digit\nmillisecond value. For most games, that is not noticeable at all and will just \"magically\"\nmake the game more smooth, like on the left window in the video above :)\n\n## Usage\n\nAdd the plugin to your project. Replace `3d` with `2d` if you are using Avian 2D.\n\n```sh\ncargo add avian_interpolation3d --git https://github.com/janhohenheim/avian_interpolation\n```\n\nit's not on crates.io yet because I'm waiting for a new `Avian` release, as this was made\ntargeting the `main` branch. This means you also need to use the `main` branch of `Avian`.\nAgain, replace `3d` with `2d` if you are using Avian 2D.\n\n```sh\ncargo add avian3d --git https://github.com/Jondolf/avian\n```\n\nNow, add [`AvianInterpolationPlugin`] to your app after [`PhysicsPlugins`] and everything Just Works™:\n\n```rust,ignore\nApp::new()\n    .add_plugins((\n        DefaultPlugins,\n        // Disabling SyncPlugin is optional, but will get you a performance boost.\n        PhysicsPlugins::default().build().disable::\u003cSyncPlugin\u003e(),\n        AvianInterpolationPlugin::default(),\n    ))\n    .run();\n```\n\nAnd that's it! The [`Transform`] component of all moving objects will now be interpolated after the physics simulation.\nThis means that the new [`Transform`] will be available in [`Update`] for rendering, spatial sound, moving your camera, etc.\nThe interpolation source will be their [`Position`] and [`Rotation`].\n\n## Limitations\n\n- Disables transform syncing, i.e. Avian's feature of translating [`Transform`] to its internal representation and vice versa.\n  - In practice, this means that you can *not* directly modify the [`Transform`] component of any rigid body anymore.\n    Use [`Position`] and [`Rotation`] instead. [`Transform`] is a purely aesthetic component and should not be modified for physics.\n    Depending on your point of view, this is actually a feature ;)\n  - You can still read the [`Transform`] of anything just as you would always do, if you want.\n  - If you still want to have your [`Transform`] changed as if you had transform syncing enabled, set [`InterpolateTransformFields::translation`] or [`InterpolateTransformFields::rotation`] to [`InterpolationMode::Last`] for that entity.\n    This will use the last available physics transform as the interpolation source instead.\n- Assumes [`PhysicsSchedule`] is left at its default value of [`FixedPostUpdate`].\n- Assumes that all entities with [`Position`] will also have [`Rotation`] and vice versa.\n- Assumes [`RigidBody`]s will not form hierarchies with other [`RigidBody`]s.\n- Assumes [`Rigidbody::Static`] objects will not move.\n- Will not interpolate scales for you\n\n## Differences to [`bevy_transform_interpolation`]\n\n- [`bevy_transform_interpolation`] works with [`Transform`] in general, while this plugin works only for Avian.\n- This plugin makes the results of the interpolation available for systems in [`Update`],\n  which is nicer to work with than [`bevy_transform_interpolation`]'s [`PostUpdate`].\n- By the above features and limitations, this plugin is less memory-intensive and does fewer checks per entity.\n  I didn't do any benchmarks, but it should be faster. *Blazingly* fast, some may say.\n- For most use-cases, this should work as a drop-in replacement for [`bevy_transform_interpolation`] as long as you\n  don't mutate rigid bodies' [`Transform`]s by hand.\n\n## Version Compatibility\n\n| `avian_interpolation` | `avian` | `bevy` |\n|---------------|---------|-------|\n| `main`       | `main` | `0.14` |\n\n[`physics_in_fixed_timestep`]: https://github.com/bevyengine/bevy/blob/main/examples/movement/physics_in_fixed_timestep.rs\n[`AvianInterpolationPlugin`]: https://github.com/janhohenheim/avian_interpolation/blob/main/src/lib.rs#L53\n[`PhysicsPlugins`]: https://docs.rs/avian3d/latest/avian3d/struct.PhysicsPlugins.html\n[`Transform`]: https://docs.rs/bevy/latest/bevy/transform/components/struct.Transform.html\n[`Position`]: https://docs.rs/avian3d/latest/avian3d/position/struct.Position.html\n[`Rotation`]: https://docs.rs/avian3d/latest/avian3d/position/struct.Rotation.html\n[`RigidBody`]: https://docs.rs/avian3d/latest/avian3d/dynamics/rigid_body/enum.RigidBody.html\n[`Rigidbody::Static`]: https://docs.rs/avian3d/latest/avian3d/dynamics/rigid_body/enum.RigidBody.html#variant.Static\n[`Update`]: https://docs.rs/bevy/latest/bevy/app/struct.Update.html\n[`PostUpdate`]: https://docs.rs/bevy/latest/bevy/app/struct.PostUpdate.html\n[`bevy_transform_interpolation`]: (https://github.com/Jondolf/bevy_transform_interpolation)\n[`PhysicsSchedule`]: https://docs.rs/avian3d/latest/avian3d/schedule/struct.PhysicsSchedule.html\n[`FixedPostUpdate`]: https://docs.rs/bevy/latest/bevy/app/struct.FixedPostUpdate.html\n[`InterpolationMode::Last`]: https://github.com/janhohenheim/avian_interpolation/blob/main/src/lib.rs#L129\n[`examples/split_screen_comparison.rs`]: https://github.com/janhohenheim/avian_interpolation/blob/main/crates/avian_interpolation3d/examples/split_screen_comparison.rs\n[`InterpolateTransformFields::translation`]: https://github.com/janhohenheim/avian_interpolation/blob/main/src/lib.rs#L101\n[`InterpolateTransformFields::rotation`]: https://github.com/janhohenheim/avian_interpolation/blob/main/src/lib.rs#L103\n[`bevy_transform_interpolation`]: https://github.com/Jondolf/bevy_transform_interpolation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanhohenheim%2Favian_interpolation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanhohenheim%2Favian_interpolation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanhohenheim%2Favian_interpolation/lists"}