Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants