Type Function Object Body Library physics.* Return value Numbers Revision Release 2024.3703 Keywords body, mass, world, center See also object:getMassLocalCenter()
A function that returns the x and y components for the body's center of mass in content coordinates.
object:getMassWorldCenter()
-- Create a rectangle local myRect = display.newRect( 0, 0, 100, 100 ) -- Add a body to the rectangle physics.addBody( myRect, "dynamic" ) -- Get mass world center values local x, y = myRect:getMassWorldCenter()