Collider:getInertia
EditReturns the inertia of the Collider.
Inertia is kind of like "angular mass". Regular mass determines how resistant the 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 = Collider: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
By default, the inertia of the Collider is kept up to date automatically as the Collider's shapes change. To disable this, use Collider:setAutomaticMass
.
Use Collider:resetMassData
to reset the inertia and other mass properties based on the Collider's shapes.
If the Collider is kinematic or all rotation axes are disabled, this returns zeroes.