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


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.


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

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


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