-
Notifications
You must be signed in to change notification settings - Fork 24
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
Better support fixed timesteps in newest Avian #61
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote some comments. You don't have to fix them - I can fix them myself once I merge after Avian 0.2 is released.
@@ -132,6 +144,11 @@ fn update_proximity_sensors_system( | |||
TnuaToggle::SenseOnly => {} | |||
TnuaToggle::Enabled => {} | |||
} | |||
let transform = Transform { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this transform
is only used for computing the cast_origin
. Maybe we can just compute it directly with the rotation and position instead of creating a transform matrix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how we would do that. Creating the transform matrix is super cheap, so I also don't think this is pressing.
Good suggestions! Fixed the things that I knew how to fix :) |
Looks like the CI ran into an infinite build. Could you rerun it if you happen to have time? :) Also, I'll try to keep this PR up to date so it's ready for Avian 0.2 when it releases. |
@janhohenheim I've updated the Avian integration crates to Avian 0.2, and since they've officially changed the default schedule I had do these changes on I did not implement any of the other things you did in this PR - just the scheduling. |
This primarily does the following things.
PostUpdate
, but inFixedUpdate
.Default
, as theTnuaControllerPlugin
needs to be manually set inPhysicsSchedule
as wellPosition
andRotation
instead ofGlobalTransform
to better support interpolation between fixed timestepsGlobalTransform
is in general just the place where the object in question will be rendered, not where it physically is.just_pressed
in demos not working reliably with a fixed timestepjust_pressed
in general does not work out of the box for fixed timesteps. LWIM would handle that, but I didn't want to add a new dependency. So, instead the demo now does its ownjust_pressed
caching.PhysicsSchedule
by default for avian.I tested and verified that all examples and demos still work.
Some of these changes like the
GlobalTransform
stuff would be nice for rapier as well, but I'll leave that for a future follow-up PR.