Skip to content
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

Add volume cast intersection tests #11586

Merged
merged 3 commits into from
Jan 31, 2024

Conversation

NiseVoid
Copy link
Contributor

@NiseVoid NiseVoid commented Jan 28, 2024

Objective

  • Add a basic form of shapecasting for bounding volumes

Solution

  • Implement AabbCast2d, AabbCast3d, BoundingCircleCast, and BoundingSphereCast
  • These are really just raycasts, but they modify the volumes the ray is casting against
  • The tests are slightly simpler, since they just use the raycast code for the heavy lifting

@NiseVoid
Copy link
Contributor Author

out.mp4

Here's a video of it working. The shapes are cast from the origin (purple point) in the direction of the line. The shapes (and their offset from the origin) can be seen at the origin. The casts only interact with shapes of the same type. When a collision happens it is shown as a green shape

@alice-i-cecile alice-i-cecile added C-Enhancement A new feature A-Math Fundamental domain-agnostic mathematical operations labels Jan 28, 2024
Copy link
Contributor

@Jondolf Jondolf left a comment

Choose a reason for hiding this comment

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

Looks good implementation-wise, mainly some typos/copy errors.

I feel like the names could be made closer and more consistent though... There's RayTest2d, with "Test" and the dimension at the end, and then there's Aabb2dCast, with "Cast" and the dimension in the middle.

An "AABB test" sounds a bit ambiguous, so that can probably remain as "Cast". Maybe put the dimension at the end though, like AabbCast2d? We could also use RayCast2d, but that might imply more advanced functionality, not entirely sure

crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest3d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest3d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest3d.rs Outdated Show resolved Hide resolved
crates/bevy_math/src/bounding/raytest2d.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Jondolf Jondolf left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, tests seem solid as well!

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 31, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 31, 2024
Merged via the queue into bevyengine:main with commit 1b98de6 Jan 31, 2024
23 checks passed
@Jondolf Jondolf mentioned this pull request Feb 4, 2024
46 tasks
tjamaan pushed a commit to tjamaan/bevy that referenced this pull request Feb 6, 2024
# Objective

- Add a basic form of shapecasting for bounding volumes

## Solution

- Implement AabbCast2d, AabbCast3d, BoundingCircleCast, and
BoundingSphereCast
- These are really just raycasts, but they modify the volumes the ray is
casting against
- The tests are slightly simpler, since they just use the raycast code
for the heavy lifting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Enhancement A new feature S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants