-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Replace collision code in breakout example with code based Aabb2d::intersects
#11479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Pinging @Jondolf for an opinion / maybe some guidance for someone wanting to do this. |
IMO we should definitely remove the |
Yes, I agree we should remove the AABB and collision stuff from
|
# Objective Fixes #11479 ## Solution - Remove `collide_aabb.rs` - Re-implement the example-specific collision code in the example, taking advantage of the new `IntersectsVolume` trait. ## Changelog - Removed `sprite::collide_aabb::collide` and `sprite::collide_aabb::Collision`. ## Migration Guide `sprite::collide_aabb::collide` and `sprite::collide_aabb::Collision` were removed. ```rust // Before let collision = bevy::sprite::collide_aabb::collide(a_pos, a_size, b_pos, b_size); if collision.is_some() { // ... } // After let collision = Aabb2d::new(a_pos.truncate(), a_size / 2.) .intersects(&Aabb2d::new(b_pos.truncate(), b_size / 2.)); if collision { // ... } ``` If you were making use `collide_aabb::Collision`, see the new `collide_with_side` function in the [`breakout` example](https://bevyengine.org/examples/Games/breakout/). ## Discussion As discussed in the linked issue, maybe we want to wait on `bevy_sprite` generally making use of `Aabb2b` so users don't need to construct it manually. But since they **do** need to construct the bounding circle for the ball manually, this doesn't seem like a big deal to me. --------- Co-authored-by: IQuick 143 <[email protected]>
) # Objective Fixes bevyengine#11479 ## Solution - Remove `collide_aabb.rs` - Re-implement the example-specific collision code in the example, taking advantage of the new `IntersectsVolume` trait. ## Changelog - Removed `sprite::collide_aabb::collide` and `sprite::collide_aabb::Collision`. ## Migration Guide `sprite::collide_aabb::collide` and `sprite::collide_aabb::Collision` were removed. ```rust // Before let collision = bevy::sprite::collide_aabb::collide(a_pos, a_size, b_pos, b_size); if collision.is_some() { // ... } // After let collision = Aabb2d::new(a_pos.truncate(), a_size / 2.) .intersects(&Aabb2d::new(b_pos.truncate(), b_size / 2.)); if collision { // ... } ``` If you were making use `collide_aabb::Collision`, see the new `collide_with_side` function in the [`breakout` example](https://bevyengine.org/examples/Games/breakout/). ## Discussion As discussed in the linked issue, maybe we want to wait on `bevy_sprite` generally making use of `Aabb2b` so users don't need to construct it manually. But since they **do** need to construct the bounding circle for the ball manually, this doesn't seem like a big deal to me. --------- Co-authored-by: IQuick 143 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
What problem does this solve or what need does it fill?
After #11439, it seems like it might be possible to nuke the breakout example's custom collision code.
The breakout example makes use of
bevy::sprite::collide_aabb::collide
which exists in Bevy solely to make this particular example work.The current collision code also assumes that the ball is a rectangle, which is no longer true!
What solution would you like?
Replace the code in
breakout
with code based on the new bounding volume intersection stuff introduced in #11439 and removebevy::sprite::collide_aabb::collide
from Bevy.breakout
is relying oncollide_aabb::collide
determining "which side of the thing was collided with," so this is slightly more involved than it sounds on the surface.What alternative(s) have you considered?
Maybe I've misjudged and it's not time for this yet.
The text was updated successfully, but these errors were encountered: