-
Notifications
You must be signed in to change notification settings - Fork 22
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
Explanation use of property group
#80
Comments
for your use. will explain shortly. for now refer to demo stress test @gregmax17 |
I read through the code and will give an explanation to the best of my understanding. It appears to only be used by the canInteract function. Is like a double bitmask where the top 16 bits are the groups that it can interact with and the bottom 16 are the groups it belongs to. Bodies with the same group number will always be able to interact. The predefined groups use less than the first 8 bits so the upper 8 bits out of the lower 16 should probably be used for custom groups,
Example:
Body 1 has the first custom group but cannot interact with any other groups except itself because the first 16 bits are all zeros, only bodies with an identical value can interact with it. |
@Prozi If you would like I could make a PR with this documentation added to the
|
The concept of Box2D Doc (Box2D > Simulation > Shapes > Filtering) |
I always love contributions and merge requests so please do |
Thank you for the links @RedPhoenixQ if you could someway include both of those as also references for docs please do I think if I recall correctly @noih is the author of those group functions in detect-collisions Thank you both for using our great library! |
@RedPhoenixQ any update on that PR please? |
I'm anxious and excited for collision filtering like this. It would be really helpful! |
@Prozi sorry for the long pause without response. I've made a PR now |
* docs: add documentation for groups Refs: #80 * docs: don't overwrite docs for group in bodies Having a doc comment on the getter will have priority over the docs provided in the BodyOptions interface
thank you very much @RedPhoenixQ your mr was really good I ran all the precommit scripts on it and published it here (and on npm) https://github.com/Prozi/detect-collisions/releases/tag/v9.17.0 @gregmax17 can we close this now if the link above is explaining ok? |
Thank you! |
yay! @gregmax17 closing as resolved |
Can you provide more info on how the collision filtering works with the
group
property, is more for our use or is it used internally?The text was updated successfully, but these errors were encountered: