beta 6.2 poly radius

Discuss new features and future development.

beta 6.2 poly radius

Postby viblo » Wed Aug 14, 2013 10:42 pm

A question about the new polygon radius: What does it do and why/when would it be useful? I if understand it correctly it just add a radius on the edges (similar to if the polygon was created by segments with radius).. but Im not sure what it would be useful for, instead of just increasing the size yourself? - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
Posts: 206
Joined: Tue Aug 21, 2007 3:12 pm

Re: beta 6.2 poly radius

Postby slembcke » Thu Aug 15, 2013 2:23 am

There are a few uses. If you want to avoid sharp edged polygons that catch on each others corners less easily. Rounded rectangles work quite well for platformer player shapes for this reason. You might also want a rounded rectangle, or some other rounded polygon as your shape. It's kind of subtle, but it's been a killer feature of the new code. Allowing me to do some things I'd been working around for years.

Lastly, (and perhaps surprisingly) rounded polygons are faster for the new collision detection algorithms to process than non-rounded ones. The new GJK/EPA based collision detection works by using the GJK algorithm to get the closest points between two polygons. GJK alone is slightly faster than the old SAT collision code. When polygons are overlapping, it also needs to run the EPA algorithm to find the minimum separation axis. GJK+EPA is slightly slower. So the polygon radii allow the shapes to collide and keep the un-beveled polygons from overlapping and requiring the extra EPA step.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! ->
User avatar
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest