Page 1 of 1

beta 6.2 poly radius

Posted: Wed Aug 14, 2013 10:42 pm
by viblo
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?

Re: beta 6.2 poly radius

Posted: Thu Aug 15, 2013 2:23 am
by slembcke
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.