aevyrie / bevy_mod_raycast

A little mesh raycasting plugin for Bevy
https://crates.io/crates/bevy_mod_raycast
MIT License
303 stars 92 forks source link

ArrayVec: capacity exceeded in extend/from_iter #86

Closed luke-biel closed 11 months ago

luke-biel commented 11 months ago

I'm using bevy_mod_raycast in my project. When upgrading from 0.8 to 0.9 along with bevy 0.11 upgrade I started getting a panic. Start of the backtrace that's relevant to the issue:

thread 'Compute Task Pool (15)' panicked at 'ArrayVec: capacity exceeded in extend/from_iter', /home/luke-biel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec.rs:1133:15
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:625:12
   1: arrayvec::arrayvec::extend_panic
             at /home/luke-biel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec.rs:1057:5
   2: arrayvec::arrayvec::ArrayVec<T,_>::extend_from_iter
             at /home/luke-biel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec.rs:1089:46
   3: <arrayvec::arrayvec::ArrayVec<T,_> as core::iter::traits::collect::Extend<T>>::extend
             at /home/luke-biel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec.rs:1048:13
   4: <arrayvec::arrayvec::ArrayVec<T,_> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /home/luke-biel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrayvec-0.7.4/src/arrayvec.rs:1133:15
   5: core::iter::traits::iterator::Iterator::collect
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/iter/traits/iterator.rs:1895:9
   6: bevy_mod_raycast::update_raycast
             at /home/luke-biel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_mod_raycast-0.9.0/src/lib.rs:496:82

When debugging the array vec I found that the amount of pick points seem to be greater than 4 defined by the array vec as a capacity.

Zaznaczenie_008

I'm looking for pointers what can be wrong with my setup (maybe model has invalid geometry, I'm also drawing the scene to an egui texture first rather than having it drawn directly to the window), or how in general fix this issue?

For model I'm using https://blendswap.com/blend/18206# converted to gltf through blender exporter. My setup is to iterate over all meshes once a scene is loaded and adding RaycastMesh to each of them.

luke-biel commented 11 months ago

I see that ArrayVec was replaced with Vec in current master. Could this be published?

aevyrie commented 11 months ago

This has been published and should now be resolved. Thanks for reporting.