object:getInertia()

Type Function
Object Body
Library physics.*
Return value Number
Revision Release 2026.3728
Keywords body, inertia
See also physics.addBody()

Overview

Returns the rotational inertia of the physics body about its center of mass.

Syntax

object:getInertia()

Example

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

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

-- Get the rotational inertia
local inertia = myRect:getInertia()
if inertia then
    print( "Rotational inertia: " .. inertia )
else
    print( "Object does not have a physics body" )
end