Equivalent of PolygonShape:getPoints() for a CircleShape?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
devyn
Prole
Posts: 12
Joined: Tue Dec 29, 2009 5:56 am

Equivalent of PolygonShape:getPoints() for a CircleShape?

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

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

Post 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.
Help us help you: attach a .love.
User avatar
devyn
Prole
Posts: 12
Joined: Tue Dec 29, 2009 5:56 am

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

Post 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...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post 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.
User avatar
devyn
Prole
Posts: 12
Joined: Tue Dec 29, 2009 5:56 am

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests