Shape:getInertia
EditReturns 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
Name | Type | Description |
dx | number | The x component of the diagonal matrix. |
dy | number | The y component of the diagonal matrix. |
dz | number | The z component of the diagonal matrix. |
angle | number | The angle of the inertia rotation. |
ax | number | The x component of the inertia rotation axis. |
ay | number | The y component of the inertia rotation axis. |
az | number | 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.