Closed rparrett closed 1 year ago
You are correct - this really is a matter of system order.
If I make the system that changes the platform's velocity run .after(bevy_tnua::TnuaPipelineStages::Sensors)
, the problem replicates on every run. If I make it run .before(bevy_tnua::TnuaPipelineStages::Sensors)
, it never happens.
I can fix the examples, but I'm not sure how I should document this. Maybe a Pitfalls section in the readme?
For me, fixing the examples (with a comment explaining why the ordering is necessary) seems like enough. Thanks for looking into it.
I sort of wonder if tnua's systems should be running in PostUpdate
, but it's all a bit awkward because I think rapier can be configured to run in any arbitrary schedule.
And in PostUpdate
getting the ordering of rapier's systems and bevy's internal systems right is more involved.
It also seems like there's no possible ordering that resolves this if the moving platform is a RigidBody::KinematicPositionBased
.
Makes sense. Tnua looks at the velocity, not the position, and with KinematicPositionBased
that means the velocity only gets update once Rapier itself runs.
Tested main (e251483)
I think that maybe the previous fix for this was only a partial fix, because I recall it still being an issue. I think I was too deep in the game-jam to report it at the time.
This also seems to be behaving like a system ordering issue to me -- on some runs the character has this behavior and on other runs it seems fine (or maybe not as bad)
Here's a recording and a patch for the scene:
https://github.com/idanarye/bevy-tnua/assets/200550/4b151174-2f0c-45fa-96e2-54f219aa5ddd