object:setRotationLimits()

Type Function
Object Joint
Library physics.*
Return value none
Revision Release 2024.3703
Keywords joint, setRotationLimits
See also object:getRotationLimits()
Physics Joints (guide)

Overview

This function accepts two values, in degrees, defining the negative and positive limits of rotation for a "pivot" joint. For example, if you want to limit the rotation somewhat tightly in relation to the upward axis (0), these values may be -10 and 10 respectively. Note that these values remain in relation to the rotation of body A, meaning that if body A rotates after the joint is declared, these rotation limits will remain in rotational synchronization with that body.

Syntax

joint:setRotationLimits( negLimit, posLimit )
negLimit, posLimit (required)

Numbers. The negative and positive limits of rotation, in degrees from 0.

Example

myJoint.isLimitEnabled = true
myJoint:setRotationLimits( -10, 10 )