Fix Vec3A mismatch in obvhs sweep helpers#947
Conversation
Jondolf
left a comment
There was a problem hiding this comment.
Thanks! Worth noting that it does already compile if you just run cargo update, but I've seen a lot of people hit the error when migrating an existing project to 0.6.0-rc, so I think it's worth doing this for the full 0.6 release to make the mismatch impossible even when Cargo pulls conflicting Glam versions.
I pushed a commit to remove the obvhs_glam dependency altogether, make all of the APIs just use Bevy's Vec3A, and simplify some of the type conversions in the helpers. I suspect that rustc should also be able to optimize the conversions to be zero-cost, but if not, we could probably use bytemuck::cast instead. In theory it's not as future-proof though, since Glam could technically change the internal representation of Vec3A in some way. Either way, I think this looks good to merge now!
This fixes a glam
Vec3Amismatch inobvhs_extwhen dependency resolution pulls different glam minors.I convert the inputs into the AABB vector type before doing arithmetic, so we avoid cross-type ops.
Checked with
cargo check -p avian3dandcargo check -p avian2d.