Flip writeback to iterate over rapier's bodies
Unsure of whether this will have a noticeable performance improvement currently. I would like to do some benchmarks on how writeback performs.
I think the bigger thing here would be to not use bevy's transform propagation/GlobalTransform and instead adapt it to our case where we update a PhysicsTransform that is more akin to the old pre-0.8 bevy GlobalTransform. This would also allow us to not update unrelated entities.
It seems that this gives a ~22% performance increase in the writeback system when profiling the boxes3 example. So seems worthwhile from initial benchmarks.
Thank you for this PR! Is there a particular reason why the .tracy files were pushed?
I’m very surprised this improves performances. Doesn’t bevy recommend iterating on bodies rather than random access through Query::get? Does bevy’s Query::iter_mut involves a large overhead?
.tracy files were unintentional sorry about that!
Yeah I wasn't expecting this to do anything honestly, I was just testing this out for the sake of the TODO comment. I'll probably investigate a bit more later on because realistically this shouldn't have any performance effect.