object:getMassLocalCenter()

Type Function
Object Body
Library physics.*
Return value Numbers
Revision 2017.3060
Keywords body, mass, local, center
See also object:getMassWorldCenter()

Overview

A function that returns the x and y components for the body's local center of mass.

Syntax

object:getMassLocalCenter()

Example

-- Create a rectangle
local myRect = display.newRect( 0, 0, 100, 100 )

-- Add a body to the rectangle
physics.addBody( myRect, "dynamic" )

-- Get mass local center values
local x, y = myRect:getMassLocalCenter()