Collider:setInertia

Edit

Sets 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.



Arguments

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, in radians.
axnumber The x component of the rotation axis.
aynumber The y component of the rotation axis.
aznumber The z component of the rotation axis.

Returns

Nothing

Arguments

NameTypeDescription
diagonalVec3 A vector containing the 3 elements of a diagonal matrix.
rotationQuat The inertia rotation.

Returns

Nothing

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, the collider behaves as though it has infinite inertia, and this function will do nothing.

See also