Prozi / detect-collisions

Points, Lines, Boxes, Polygons (also hollow), Ellipses, Circles. RayCasting, offsets, rotation, scaling, bounding box padding, flags for static and ghost/trigger bodies
https://prozi.github.io/detect-collisions/
MIT License
206 stars 22 forks source link

fix: should not be assumed to always interact with the same group #76

Closed noih closed 6 months ago

noih commented 6 months ago

The interactive group is set by the users and should not be assumed to always interact with the same group. For example, a circle can also collide with a rectangle, but they still belong to different groups.

Stress testing is set to the same group only for testing purposes.

Here are two links for reference: Box2d Doc Box2D Tutorial: Collision filtering

noih commented 6 months ago

Based on the concept of specifying interact rather than just being in the same group, naming the checking function canInteract or checkInteract is more appropriate.

Prozi commented 6 months ago

this is sweet thanks again!! @noih

but I'd like to also create some kind of util/function for

(BodyGroup.Ellipse << 16) | BodyGroup.Ellipse;

this (SOMEGROUP1 << 16) | SOMEGROUP2 could have some function cause I dont believe this is clear

thx !!!

can u suggest something?

noih commented 6 months ago

I added a groupBits utility function. Hopefully that is helpful.

Prozi commented 6 months ago

I added a groupBits utility function. Hopefully that is helpful.

this is I think what I meant

Prozi commented 6 months ago

@noih here https://github.com/Prozi/detect-collisions/releases/tag/v9.8.0 <3