类型 函数 对象 Body 库 physics.* 返回值 数字 修订 版本 2024.3703 关键词 body, 质量, 世界, 中心 另请参阅 object:getMassLocalCenter()
此函数返回 body 质心在内容坐标系中的 x 和 y 分量。
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()