Math help

I have an physics object. Also, I have it set up where you press once it gets bigger, removes physics then adds back again. My problem is when new physics body being added the radius stays the same as it was. I’m trying to figure out a formula where the radius will be according to new size.
Any help?
Thanks [import]uid: 11559 topic_id: 21510 reply_id: 321510[/import]

The image, is it a circle or a square? If it’s a circle you can grab its radius or if it is a square shape (but you want a circle body) you could set the new body radius to obj.width/2.

EG;

[lua]display.setStatusBar (display.HiddenStatusBar)

– Set up physics
require ( “physics” )
physics.start()
physics.setGravity( 0, 0 )
physics.setDrawMode ( “hybrid” )

local box = display.newRect( 100, 100, 40, 40 )
physics.addBody(box, {radius=box.width/2})[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 21510 reply_id: 85133[/import]

Thank you so much! The solution is so simple. lol
I have spend few days on this trying to figure out. Thanks you saved me bunch of time. [import]uid: 11559 topic_id: 21510 reply_id: 85332[/import]

Not a problem - glad I could save you some time :slight_smile: [import]uid: 52491 topic_id: 21510 reply_id: 85456[/import]