Skip to content

Fix Vec3A mismatch in obvhs sweep helpers#947

Merged
Jondolf merged 3 commits into
avianphysics:mainfrom
muxyng:fix/vec3a-interop
Mar 13, 2026
Merged

Fix Vec3A mismatch in obvhs sweep helpers#947
Jondolf merged 3 commits into
avianphysics:mainfrom
muxyng:fix/vec3a-interop

Conversation

@muxyng

@muxyng muxyng commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

This fixes a glam Vec3A mismatch in obvhs_ext when 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 avian3d and cargo check -p avian2d.

@Jondolf Jondolf added the C-Dependencies A change to the crates that Avian depends on label Mar 7, 2026
@Jondolf Jondolf added this to the 0.6 milestone Mar 13, 2026

@Jondolf Jondolf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@Jondolf Jondolf merged commit 14aa8c8 into avianphysics:main Mar 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Dependencies A change to the crates that Avian depends on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants