Page 1 of 1

Equivalent of PolygonShape:getPoints() for a CircleShape?

Posted: Fri Jan 01, 2010 6:09 pm
by devyn
Per the documentation:
Circle extends Shape and adds a radius and a local position.
However, there is no getRadius method, nor a getPosition method. So how exactly would I do this? PolygonShape has getPoints() so are there equivalent methods for circle shapes?

Edit: Apparently there is a getRadius method — it's just not documented in 0.6.0. But I still don't know how to get the offset for the shape.

Re: Equivalent of PolygonShape:getPoints() for a CircleShape?

Posted: Fri Jan 01, 2010 6:23 pm
by Robin
Well, you pass them to love.physics.newCircleShape(), so if you ever need them, just keep them around in a table. The Shape itself won't change.

Re: Equivalent of PolygonShape:getPoints() for a CircleShape?

Posted: Fri Jan 01, 2010 6:37 pm
by devyn
Robin wrote:Well, you pass them to love.physics.newCircleShape(), so if you ever need them, just keep them around in a table. The Shape itself won't change.
Yeah, okay. I looked at the source—that really should be exposed. It would be easy to do...

Re: Equivalent of PolygonShape:getPoints() for a CircleShape?

Posted: Fri Jan 01, 2010 6:43 pm
by bartbes
I added getRadius to the docs (which you can do by yourself btw, it's wiki-like).
About the position, you might use getBoundingBox.

Re: Equivalent of PolygonShape:getPoints() for a CircleShape?

Posted: Fri Jan 01, 2010 7:46 pm
by devyn
bartbes wrote:About the position, you might use getBoundingBox.
Oh, haha, didn't think to find the center of the getBoundingBox! :P Thanks! And about the wiki-like docs... I just noticed that 'edit' link now—it's not very visible.