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

collide_aabb is completely broken #2720

Closed
rukai opened this issue Aug 24, 2021 · 3 comments
Closed

collide_aabb is completely broken #2720

rukai opened this issue Aug 24, 2021 · 3 comments
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@rukai
Copy link
Contributor

rukai commented Aug 24, 2021

Bevy version

v0.5

What you did

the provided AABB is broken.
https://docs.rs/bevy/0.5.0/bevy/sprite/collide_aabb/fn.collide.html

Consider this example which should clearly collide but returns None.

println!("{:?}", collide_aabb::collide(Vec3::new(160.0, 275.0, 0.0), Vec2::new(80.0, 50.0), Vec3::new(232.0, 294.0, 0.0), Vec2::new(20.0, 20.0)));

Here is an example app which you can use to help diagnose the problem.
https://github.com/rukai/bevy_collision_bug_demo/blob/main/src/main.rs

@rukai rukai added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 24, 2021
@alice-i-cecile
Copy link
Member

Yep, looks like Bevy's bug. This should have proper tests and be rewritten, even if it's not being used for anything serious yet.

@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples D-Trivial Nice and easy! A great choice to get started with Bevy and removed S-Needs-Triage This issue needs to be labelled labels Aug 24, 2021
@rukai
Copy link
Contributor Author

rukai commented Aug 24, 2021

Ah!
Looking at the code I sudenly realized the implementation is correct.
The real problem is that the expected format of the args is not documented and I expected them to be in the traditional AABB format.

@alice-i-cecile
Copy link
Member

Ah, that makes sense :) Taking a look at https://github.com/bevyengine/bevy/blob/b724a0f586e6186f2a6ce4eb7903be0e340649e9/crates/bevy_sprite/src/collide_aabb.rs, it looks like we need a) quick docs b) some basic tests.

Not super urgent, but still worth doing as a nice first issue for whoever wants it :)

@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation and removed C-Bug An unexpected or incorrect behavior labels Aug 24, 2021
@bors bors bot closed this as completed in c5717b5 Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants