Jondolf/avian

Allow manipulation of `ColliderConstructor` at runtime

janhohenheim opened this issue · 0 comments

Don't remove ColliderConstructor after creating a Collider and allow changes to ColliderConstructor to affect Collider.

This allows two things:

  • Fiddling with it through an editor to get the right collider (suggested by @Occuros)
    • E.g. bevy_editor_pls. Also needed for Blenvy, since that one will slap on a new ColliderConstructor, which in turn would be ignored since there is already a Collider.
  • Rebuilding a dynamically constructed collider through hot-reloading (suggested by @jirisvd)
    • E.g. recalculate a TrimeshFromMesh when a GLTF has changed.

Don't know if ColliderConstructor would still be the best name then.
Also, to keep the scope low, I'd simply ignore any changes made to the Collider at runtime and not reflect them in the ColliderConstructor. Which is an argument for keeping the current name.

For consistency, we should probably also allow adding a ColliderConstructor to a Collider that previously had none at runtime to overwrite it.