idanarye / bevy-tnua

A floating character controller for Bevy
https://crates.io/crates/bevy-tnua
Apache License 2.0
180 stars 12 forks source link

Panic when using XPBD from repo "rev =" #37

Closed dror-g closed 6 months ago

dror-g commented 6 months ago

Hi, sorry this might be a silly mistake on my part, but perhaps you could help:

When setting bevy_xpbd_3d to a specific rev from git repo, I get an error:
Cargo.toml:
bevy_xpbd_3d = { git = "...github/bevy_xpbd", rev = "fedsf3221" }
Error:
Resource requested by <bevy_tnua_xpbd3d::TnuaXpbd3dPlugin as bevy_app::plugin::Plugin>::build::{{closure}} does not exist: bevy_time::time::Time<bevy_xpbd_3d::plugins::setup::time::Physics>

It happens with any commit. Even versions of xpbd that work if used in bevy_xpbd_3d = { version = "0.3.3"}.

I noticed that when using { git = , rev = } in xpbd - Tnua does not seem to be rebuilt, and I get the error.
But after setting xpbd back to version = "0.3.3", Tnua seems to be rebuilt along with it:
Compiling bevy-tnua-xpbd3d v0.1.1

Not sure what the cause is, tried with many commits in xpbd repo, even old ones, so I don't think something actually changed there and broke Tnua.
I must be using rev = wrong or a version/commit hardcoded somewhere in Tnua? (deleted Cargo.lock and rebuilt several times as well)

Thanks for your help!!

idanarye commented 6 months ago

The problem, I believe, is that when you use bevy_xpbd_3d with a specific commit it automatically becomes different version from what bevy-tnua-xpbd3d expects. I think you can work around this with [patch]: https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html

dror-g commented 6 months ago

Thanks Idan!

dror-g commented 6 months ago

For the record - I attempted to use the latest commits of XPBD that included some minor performance optimizations like https://github.com/Jondolf/bevy_xpbd/pull/272 , but they had no effect on performance impact of a thousand colliding entities.