Not for a physics body but rather a regular display object.
what do you mean?
a bit more information or context could help.
Sorry about that. I have a picture of a soccer ball for instance and instead of using the x and y settings to set the size for the picture, I was wondering if there was a radius setting I could just use. I know when using the physics option in corona it is an option but I don’t know if I can incorporate that into a regular display.newImage or display.newImageRect
no there is no way to do that directly because corona sees your ball as a rectangle with some transparent pixels, and doesnt know that the combination of transparent and nontransparent pixels actually show a circle.
BUUUUUUUUT, of course you could solve that with a tiny bit of math.
because the radius of your ball is nothing else than half the width of the rectangular png that is carrying your ball, of course just in case you trimmed your png accordingly.
so something like that could be it
[lua]
local function setRadius(obj, rad)
obj.width, obj.height = rad * 2, rad*2
end
setRadius(mySoccerballObject, 50)
[/lua]
but that calculation is so easy that it might be worth a consideration if it really needs its own function instead of just scaling the object directly while keeping in mind that the radius is nothing else than half the image rect’s width and height.
i hope i didnt get you wrong and that this somehow solved your problem,
cheerio,
fox
what do you mean?
a bit more information or context could help.
Sorry about that. I have a picture of a soccer ball for instance and instead of using the x and y settings to set the size for the picture, I was wondering if there was a radius setting I could just use. I know when using the physics option in corona it is an option but I don’t know if I can incorporate that into a regular display.newImage or display.newImageRect
no there is no way to do that directly because corona sees your ball as a rectangle with some transparent pixels, and doesnt know that the combination of transparent and nontransparent pixels actually show a circle.
BUUUUUUUUT, of course you could solve that with a tiny bit of math.
because the radius of your ball is nothing else than half the width of the rectangular png that is carrying your ball, of course just in case you trimmed your png accordingly.
so something like that could be it
[lua]
local function setRadius(obj, rad)
obj.width, obj.height = rad * 2, rad*2
end
setRadius(mySoccerballObject, 50)
[/lua]
but that calculation is so easy that it might be worth a consideration if it really needs its own function instead of just scaling the object directly while keeping in mind that the radius is nothing else than half the image rect’s width and height.
i hope i didnt get you wrong and that this somehow solved your problem,
cheerio,
fox