Collider:setDegreesOfFreedom

Edit

Set the degrees of freedom of the Collider.

Collider:setDegreesOfFreedom(translation, rotation)

Arguments

NameTypeDescription
translationstring A string containing the world-space axes the Collider is allowed to move on. The string should have 'x', 'y', and 'z' letters representing the axes to enable. Use nil or an empty string to disable all translation.
rotationstring A string containing the world-space axes the Collider is allowed to rotate on. The string should have 'x', 'y', and 'z' letters representing the axes to enable. Use nil or an empty string to disable all rotation.

Returns

Nothing

Notes

The default state is xyz for both translation and rotation.

The physics engine does not support disabling all degrees of freedom. At least one translation or rotation axis needs to be enabled. To disable all movement for a collider, make it kinematic.

When all translation axes are disabled, Collider:getMass will return 0.

When all rotation axes are disabled, Collider:getInertia will return zero/identity.

See also