Joints are used to assemble more complex game objects from multiple rigid bodes. To construct a joint, first construct the bodies that will be joined, and then call this method with the desired joint constructor type.
To remove a joint, use joint:removeSelf( )
NOTE: This API reference page is incomplete. See the Physics Joint Guide to see how to deal with the various joints.
physics.newJoint( jointType, object1, object2, anchorX, anchorY )
myJoint = physics.newJoint( "pivot", crateA, crateB, 200,300 )
string: One of the following joint types:
First object used in joint.
Second object used in joint.
Defines the X-location of the joint anchor point.
Defines the Y-location of the joint anchor point.
Starting with build 2011.598, returns
joint object if the API succeeded or
nil if it failed. (The API will fail if called in any Collision Event handler.)
Note: This API should not be used in a Collision Event handler.
Starting with build 2011.598, this API returns
nil and display a warning message in the simulator if the API cannot be processed. Before build 2011.598, calling the API may crash the simulator and the app when running on the device.
Supported on operating systems and platforms for build numbers shown:
- Mac OS X:Build 2010.222
- Windows:Build 2010.222
- iOS:Build 2010.222
- Android:Build 2010.222