You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently circles are just many-sided polygons, which works a lot of the time, but sometimes it really breaks down. Especially with small circles, the way they collide / interact with other objects makes it clear it's just a 13gon etc.
What would be involved in supporting circles? Digging into the source code a little, the Body is all about vertices. It would be annoying to have an isCircle flag or something that would then need to be checked in all of the Body.___ functions. But maybe that's the best way?
The text was updated successfully, but these errors were encountered:
The bulk of the work would be implementing circle-polygon collisions in SAT. This requires a special case, but it can be done. It's a feature that should be added for sure.
It would be annoying to have an isCircle flag or something that would then need to be checked in all of the Body.___ functions. But maybe that's the best way?
Exactly and there actually already is the (undocumented) body.circleRadius property which is currently only used for rendering but was intended to be used for real circles when they're implemented.
An important thing to know is that Bodies.circle automatically decides a number of sides and it doesn't do a great job for very small circles (this needs improving).
Instead try using Bodies.polygon with a high number of sides (e.g. 50) and you should get better results even with a small radius.
Currently circles are just many-sided polygons, which works a lot of the time, but sometimes it really breaks down. Especially with small circles, the way they collide / interact with other objects makes it clear it's just a 13gon etc.
What would be involved in supporting circles? Digging into the source code a little, the
Body
is all about vertices. It would be annoying to have anisCircle
flag or something that would then need to be checked in all of theBody.___
functions. But maybe that's the best way?The text was updated successfully, but these errors were encountered: