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

Circle Shape Collider #782

Open
peratik opened this issue Nov 9, 2023 · 2 comments
Open

Circle Shape Collider #782

peratik opened this issue Nov 9, 2023 · 2 comments

Comments

@peratik
Copy link

peratik commented Nov 9, 2023

Hi,

How to add a circle shape collider?

I know area has a property for setting shape

But it seems circle colliders is not supported.

@ganevdev
Copy link

ganevdev commented Feb 10, 2024

Yes, I have the same problem. https://kaboomjs.com/#AreaCompOpt - the documentation says that "currently only Rect and Polygon is supported".

Circle is not supported, but given that polygon is supported, I think you can just make the polygon in the shape of a circle.

@mflerackers
Copy link
Contributor

The problem is that the SAT collision code only knows how to work with polygons. If this is fixed, circle areas can stay circle areas.
To fix it, you need to add code to find the polygon point (not vertex, point) closest to the circle and take the orthogonal to the line connecting that point and the circle center as projection axis. To find the point quickly, you need Voronoi partitioning of the polygon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants