Shape:getInertia

Edit

Returns the inertia of the Shape.

Inertia is kind of like "angular mass". Regular mass determines how resistant a Collider is to linear forces (movement), whereas inertia determines how resistant the Collider is to torque (rotation). Colliders with less inertia are more spinny.

In 3D, inertia is represented by a 3x3 matrix, called a tensor. To make calculations easier, the physics engine stores the inertia using eigenvalue decomposition, splitting the matrix into a diagonal matrix and a rotation. It's complicated!

In a realistic simulation, mass and inertia follow a linear relationship. If the mass of an object increases, the diagonal part of its inertia should increase proportionally.

dx, dy, dz, angle, ax, ay, az = Shape:getInertia()

Arguments

None

Returns

NameTypeDescription
dxnumber The x component of the diagonal matrix.
dynumber The y component of the diagonal matrix.
dznumber The z component of the diagonal matrix.
anglenumber The angle of the inertia rotation.
axnumber The x component of the inertia rotation axis.
aynumber The y component of the inertia rotation axis.
aznumber The z component of the inertia rotation axis.

Notes

MeshShape and TerrainShape do not have mass or volue, and for those shapes this function returns zeroes.

See also