Use IntersectsVolume for breakout example collisions#11500
Merged
alice-i-cecile merged 5 commits intobevyengine:mainfrom Jan 29, 2024
Merged
Use IntersectsVolume for breakout example collisions#11500alice-i-cecile merged 5 commits intobevyengine:mainfrom
IntersectsVolume for breakout example collisions#11500alice-i-cecile merged 5 commits intobevyengine:mainfrom
Conversation
Aabb2d::intersects for breakout example collisions
Aabb2d::intersects for breakout example collisionsIntersectsVolume for breakout example collisions
IQuick143
reviewed
Jan 24, 2024
Co-authored-by: IQuick 143 <IQuick143cz@gmail.com>
Co-authored-by: IQuick 143 <IQuick143cz@gmail.com>
Jondolf
approved these changes
Jan 24, 2024
Contributor
Jondolf
left a comment
There was a problem hiding this comment.
Looks pretty good to me! A couple of simple comments on the collision function could be nice especially since this is an example, but it's quite understandable either way so it's non-blocking
IQuick143
approved these changes
Jan 25, 2024
41 tasks
tjamaan
pushed a commit
to tjamaan/bevy
that referenced
this pull request
Feb 6, 2024
) # 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 <IQuick143cz@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fixes #11479
Solution
collide_aabb.rsIntersectsVolumetrait.Changelog
sprite::collide_aabb::collideandsprite::collide_aabb::Collision.Migration Guide
sprite::collide_aabb::collideandsprite::collide_aabb::Collisionwere removed.If you were making use
collide_aabb::Collision, see the newcollide_with_sidefunction in thebreakoutexample.Discussion
As discussed in the linked issue, maybe we want to wait on
bevy_spritegenerally making use ofAabb2bso 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.