jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.15k stars 169 forks source link

Rapier2D components #36

Closed no-materials closed 2 years ago

no-materials commented 2 years ago

Thanks for the great crate. I am currently facing an issue while trying to inspect rapier2D-specific components such as RigidBodyPosition or ColliderType. The message Inspectable has not been defined for this component is shown, even though:

Is there anything I am missing in order to get this going?

Luminoth commented 2 years ago

It looks like rapier support might have been removed for now? Just from looking at the Cargo.toml here.

lemunozm commented 2 years ago

Hi, is there any reason why rapier support is removed? Is there any workaround?

jakobhellermann commented 2 years ago

I removed it when releasing a version compatible with bevy 0.6 because at that point there was no compatible bevy_rapier version yet.

I also wanted to decouple bevy-inspector-egui releases from bevy_rapier, so I experimented with a separate integration crate: https://github.com/jakobhellermann/bevy-inspector-egui/tree/external-rapier/integrations/bevy-inspector-egui-rapier. You can try that and let me know how it works for you.

bevy-inspector-egui-rapier = { git = "https://github.com/jakobhellermann/bevy-inspector-egui", branch = "external-rapier", features = ["rapier3d"] }
jakobhellermann commented 2 years ago

I was gonna release that version on crates.io once rapier 0.12 is out of alpha but if that takes a while it might be worth publishing already and doing an update when rapier releases.

lemunozm commented 2 years ago

Hi @jakobhellermann,

I tested the example (rapier2d) on the repo and it works fine 😃. Nevertheless, if I copy that example out of the repo, the components are not inspectable. I'm not sure if is something related to depdendencies, but I think I have the correct ones:

bevy = { version = "0.6.0", features = ["dynamic"] }
bevy_rapier2d = "0.12"
bevy-inspector-egui = "0.8"
bevy-inspector-egui-rapier = { git = "https://github.com/jakobhellermann/bevy-inspector-egui", branch = "external-rapier", features = ["rapier2d"] }
jakobhellermann commented 2 years ago

Are you using the world inspector or something like a InspectorQuery?

The external bevy-inspector-egui-rapier crate doesn't actually implement Inspectable for the rapier types (this isn't allowed because of the orphan rules), but just 'registers' the types so that they can be displayed in the world inspector. My guess was that this is fine because most people won't have rapier types in their resources, they just want to inspect the ones already in the world.

lemunozm commented 2 years ago

Hi,

I'm using exactly the rapier2d example but from copied into my crate. A copy-paste without any modification, so my inspectors are:

        .add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
        .add_plugin(WorldInspectorPlugin::new())
        .add_plugin(bevy_inspector_egui_rapier::InspectableRapierPlugin)

Regarding what you say, if Inspectable is not allowed, can I do something in order to inspect some properties of a rapier component? any workaround? I would expect that my app would behave like in the example.

jakobhellermann commented 2 years ago

In what way exactly is it not working? Do you see the world inspector but can't edit the components? For reference, this is what I would expect the world inspector to look like: image

lemunozm commented 2 years ago

Sorry, maybe I did not explain well the error. I share the same capture:

issue

The same message appears in all rapier components. I would expect the behavior to be the same as yours.

jakobhellermann commented 2 years ago

Can you post the output of

cargo tree -i rapier2d
cargo tree -i bevy
cargo tree -i bevy-inspector-egui

?

I suspect that there are multiple versions of one of these crates active or something like that.

lemunozm commented 2 years ago

Your suspects are right!

  bevy-inspector-egui:0.8.1                                                                                            │
  bevy-inspector-egui:0.8.2

I will check what is happing 😵‍💫

lemunozm commented 2 years ago

At Cargo.toml:

bevy = { version = "0.6.0", features = ["dynamic"] }
bevy_rapier2d = "0.12"
# bevy-inspector-egui = "0.8" # Removed
bevy-inspector-egui = { git = "https://github.com/jakobhellermann/bevy-inspector-egui", branch = "external-rapier" } # Added
bevy-inspector-egui-rapier = { git = "https://github.com/jakobhellermann/bevy-inspector-egui", branch = "external-rapier", features = ["rapier2d"] }

Fixed the issue removing the commented line and adding the next one.

Thanks for the help!

jakobhellermann commented 2 years ago

I think this can be closed now that https://github.com/jakobhellermann/bevy-inspector-egui/tree/main/integrations/bevy-inspector-egui-rapier is published.