Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choppy horizontal movement in avian2d platrofmer demo #78

Closed
vladinator1000 opened this issue Jan 11, 2025 · 2 comments
Closed

Choppy horizontal movement in avian2d platrofmer demo #78

vladinator1000 opened this issue Jan 11, 2025 · 2 comments

Comments

@vladinator1000
Copy link

vladinator1000 commented Jan 11, 2025

Heya, there seems to be a stutter when running the avian2d demo, I removed most of the level colliders to illustrate the issue:

2025-01-11.14-21-06.mp4

I'm on Windows 11, ran the demo with this command (set the wgpu backend env var to prevent log noise in the terminal):

$env:WGPU_BACKEND="dx12"; cargo run --bin platformer_2d --features avian2d

In the Avian docs, they have a PhysicsInterpolationPluigin so I thought that might help https://docs.rs/avian3d/latest/avian3d/interpolation/struct.PhysicsInterpolationPlugin.html

But it didn't, here are the things I've tried to debug using the above docs:

  1. Adding a TransformExtrapolation and TransformInterpolation component to the setup_player function in for_2d_platformer.rs
  2. Changing the physics plugin addition fn main in platformer_2d.rs to
               app.add_plugins(
                    PhysicsPlugins::new(FixedPostUpdate)
                        .set(avian2d::interpolation::PhysicsInterpolationPlugin::interpolate_all()),
                );

Possibly related links:

@idanarye
Copy link
Owner

I tried to run this locally while logging the X velocity, and it stayed the same during the run even though I've seen the stuttering. Since Tnua never mutates the transform, and the velocity remains constant - this is not Tnua's fault.

That being said - it does happen in both Avian2d and Rapier2d (though it's less noticeable in the latter). Maybe they do the same mistake?

@vladinator1000
Copy link
Author

@idanarye that makes sense to me 🙌🏼 I opened an issue in Avian Jondolf/avian#625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants