PDG engine v0.9.5
 All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
CpConstraint Class Reference

describes how two sprites are connected to one another (Chipmunk Physics Only) More...

Public Member Functions

 activateBodies ()
 wake up sleeping or idle parts of a joint More...
 
Offset getAnchor ()
 gets the anchor point for the joint on the primary sprite for pin, slide and spring joints More...
 
number getErrorBias ()
 get the percentage of joint error than remains unfixed after one second More...
 
number getGearInitialAngle ()
 get the initial angular offset between the two sprites joined with a gear joint More...
 
number getGearRatio ()
 get the ratio of rotation between the two sprites joined with a gear joint More...
 
Offset getGrooveEnd ()
 get the position on the primary sprite of the end of the groove for a groove joint More...
 
Offset getGrooveStart ()
 get the position on the primary sprite of the start of the groove for a groove joint More...
 
number getImpulse ()
 get the last impulse applied by the joint More...
 
number getMaxAngle ()
 get the maximum angle allowed by a RotaryLimit joint More...
 
number getMaxBias ()
 get the maximum speed at which a joint can be error corrrected More...
 
number getMaxForce ()
 get the maximum force the joint can apply to the sprites More...
 
number getMinAngle ()
 get the minimum angle allowed by a RotaryLimit joint More...
 
number getMotorSpinRate ()
 get how fast the sprites rotate relative to one another in a motor joint More...
 
Offset getOtherAnchor ()
 gets the anchor point for the joint on the secondary sprite More...
 
Sprite getOtherSprite ()
 get the secondary Sprite for the joint More...
 
number getPinDist ()
 get the distance between the anchors on a pin joint More...
 
number getRatchetAngle ()
 get the current angle of a ratchet joint More...
 
number getRatchetInterval ()
 get the distance between backstops on a ratchet joint More...
 
number getRatchetPhase ()
 get the initial offset for the ratchet backstops on a ratchet joint More...
 
number getRotarySpringRestAngle ()
 get the angle between sprites at which a rotary spring is at rest on a rotary spring joint More...
 
number getSlideMaxDist ()
 get the maximum distance apart for the anchors of a slide joint More...
 
number getSlideMinDist ()
 get the minimum distance apart for the anchors of a slide joint More...
 
number getSpringDamping ()
 get the damping for a rotary spring or a spring joint More...
 
number getSpringRestLength ()
 get the distance between anchors at which the spring is at rest for a spring joint More...
 
number getSpringStiffness ()
 get the stiffness for a rotary spring or a spring joint More...
 
Sprite getSprite ()
 get the primary Sprite for the joint More...
 
string getType ()
 returns a string for the type of joint More...
 
CpConstraint setAnchor (Offset inAnchor)
 sets the anchor point for the joint on the primary sprite for pin, slide and spring joints More...
 
CpConstraint setErrorBias (number inErrorBias)
 set the percentage of joint error than remains unfixed after one second More...
 
CpConstraint setGearInitialAngle (number inGearInitialAngle)
 set the initial angular offset between the two sprites joined with a gear joint More...
 
CpConstraint setGearRatio (number inGearRatio)
 set the ratio of rotation between the two sprites joined with a gear joint More...
 
CpConstraint setGrooveEnd (Offset inGrooveEnd)
 set the position on the primary sprite of the end of the groove for a groove joint More...
 
CpConstraint setGrooveStart (Offset inGrooveStart)
 set the position on the primary sprite of the start of the groove for a groove joint More...
 
CpConstraint setMaxAngle (number inMaxAngle)
 set the maximum angle allowed by a RotaryLimit joint More...
 
CpConstraint setMaxBias (number inMaxBias)
 set the maximum speed at which a joint can be error corrrected More...
 
CpConstraint setMaxForce (number inMaxForce)
 set the maximum force the joint can apply to the sprites More...
 
CpConstraint setMinAngle (number inMinAngle)
 set the minimum angle allowed by a RotaryLimit joint More...
 
CpConstraint setMotorSpinRate (number inMotorSpinRate)
 set how fast the sprites rotate relative to one another in a motor joint More...
 
CpConstraint setOtherAnchor (Offset inOtherAnchor)
 sets the anchor point for the joint on the secondary sprite More...
 
CpConstraint setPinDist (number inPinDist)
 set the distance between the anchors on a pin joint More...
 
CpConstraint setRatchetAngle (number inRatchetAngle)
 set the current angle of a ratchet joint More...
 
CpConstraint setRatchetInterval (number inRatchetInterval)
 set the distance between backstops on a ratchet joint More...
 
CpConstraint setRatchetPhase (number inRatchetPhase)
 set the initial offset for the ratchet backstops on a ratchet joint More...
 
CpConstraint setRotarySpringRestAngle (number inRotarySpringRestAngle)
 set the angle between sprites at which a rotary spring is at rest on a rotary spring joint More...
 
CpConstraint setSlideMaxDist (number inSlideMaxDist)
 set the maximum disable apart for the anchors of a slide joint More...
 
CpConstraint setSlideMinDist (number inSlideMinDist)
 set the minimum distance apart for the anchors of a slide joint More...
 
CpConstraint setSpringDamping (number inSpringDamping)
 set the damping for a rotary spring or a spring joint More...
 
CpConstraint setSpringRestLength (number inSpringRestLength)
 set the distance between anchors at which the spring is at rest for a spring joint More...
 
CpConstraint setSpringStiffness (number inSpringStiffness)
 set the stiffness for a rotary spring or a spring joint More...
 

Detailed Description

describes how two sprites are connected to one another (Chipmunk Physics Only)

Warning
API Stability: 1 - Experimental. This API was introduced recently and has gotten little or no real use. It may change or be removed in future versions. It may not be completely implemented and may be missing important pieces of functionality. Please try it out and provide feedback.

Setup of joints can be done directly through methods of the Sprite object. The CpConstraint object exists to allow joints to be modified dynamically after they've been set up, such as by changing the range of motion on a damaged joint.

See Also
Sprite.gear()
Sprite.grooveJoint()
Sprite.motor()
Sprite.pinJoint()
Sprite.pivotJoint()
Sprite.ratchet()
Sprite.rotaryLimit()
Sprite.rotarySpring()
Sprite.slideJoint()
Sprite.springJoint()
Sprite.makeJointBreakable()
Sprite.makeJointUnbreakable()
Sprite.removeJoint()
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint

Member Function Documentation

activateBodies ( )

wake up sleeping or idle parts of a joint

Calls Chipmunk's cpBodyActivate() for both of the joined bodies.

Note
Not sure this ever needs to be called directly, it is marked as private in the Chipmunk headers. However cpBodyActivate is not private, so it's unclear why this would be. It's included in this interface in case it is useful.
getAnchor ( )

gets the anchor point for the joint on the primary sprite for pin, slide and spring joints

See Also
setAnchor
getOtherAnchor
Sprite.pinJoint()
Sprite.slideJoint()
Sprite.springJoint()
getErrorBias ( )

get the percentage of joint error than remains unfixed after one second

See Also
setErrorBias
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
getGearInitialAngle ( )

get the initial angular offset between the two sprites joined with a gear joint

Note
This is referred to as "phase" in the Chipmunk docs and this call corresponds to cpGearJointGetPhase() in the Chipmunk API
See Also
setGearInitialAngle
getGearRatio
Sprite.gear()
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
getGearRatio ( )

get the ratio of rotation between the two sprites joined with a gear joint

See Also
setGearRatio
getGearInitialAngle
Sprite.gear()
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
getGrooveEnd ( )

get the position on the primary sprite of the end of the groove for a groove joint

See Also
setGrooveEnd
getGrooveStart
Sprite.grooveJoint()
getGrooveStart ( )

get the position on the primary sprite of the start of the groove for a groove joint

See Also
setGrooveStart
getGrooveEnd
Sprite.grooveJoint()
getImpulse ( )

get the last impulse applied by the joint

See Also
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
getMaxAngle ( )

get the maximum angle allowed by a RotaryLimit joint

See Also
setMaxAngle
getMinAngle
Sprite.rotaryLimit()
getMaxBias ( )

get the maximum speed at which a joint can be error corrrected

See Also
setMaxBias
getMaxForce ( )

get the maximum force the joint can apply to the sprites

See Also
setMaxForce
getMinAngle ( )

get the minimum angle allowed by a RotaryLimit joint

See Also
setMinAngle
getMaxAngle
Sprite.rotaryLimit()
getMotorSpinRate ( )

get how fast the sprites rotate relative to one another in a motor joint

See Also
setMotorSpinRate()
Sprite.motor()
getOtherAnchor ( )

gets the anchor point for the joint on the secondary sprite

See Also
setOtherAnchor
Sprite.grooveJoint()
Sprite.pinJoint()
Sprite.slideJoint()
Sprite.springJoint()
getOtherSprite ( )

get the secondary Sprite for the joint

When you create a joint in the PDG Engine, you do this by calling one of the Joint or Limit functions of a Sprite, and passing in another Sprite as a parameter. The sprite that you passed in as a parameter is the secondary Sprite.

Note
The secondary sprite is the one represented by the cpBody in Chipmunk retrieved calling cpConstraintGetB()
Returns
the secondary Sprite for the joint
See Also
Sprite.gear()
Sprite.grooveJoint()
Sprite.motor()
Sprite.pinJoint()
Sprite.pivotJoint()
Sprite.ratchet()
Sprite.rotaryLimit()
Sprite.rotarySpring()
Sprite.slideJoint()
Sprite.springJoint()
getPinDist ( )

get the distance between the anchors on a pin joint

See Also
setPinDist
Sprite.pinJoint()
getRatchetAngle ( )

get the current angle of a ratchet joint

See Also
setRatchetAngle
getRatchetInterval
getRatchetPhase
Sprite.ratchet()
getRatchetInterval ( )

get the distance between backstops on a ratchet joint

See Also
setRatchetInterval
getRatchetAngle
getRatchetPhase
Sprite.ratchet()
getRatchetPhase ( )

get the initial offset for the ratchet backstops on a ratchet joint

See Also
setRatchetPhase
getRatchetAngle
getRatchetInterval
Sprite.ratchet()
getRotarySpringRestAngle ( )

get the angle between sprites at which a rotary spring is at rest on a rotary spring joint

See Also
setRotarySpringRestAngle
Sprite.rotarySpring()
getSlideMaxDist ( )

get the maximum distance apart for the anchors of a slide joint

See Also
setSlideMaxDist
getSlideMinDist
Sprite.slideJoint()
getSlideMinDist ( )

get the minimum distance apart for the anchors of a slide joint

See Also
setSlideMinDist
getSlideMaxDist
Sprite.slideJoint()
getSpringDamping ( )

get the damping for a rotary spring or a spring joint

See Also
setSpringDamping
getSpringStiffness
Sprite.rotarySpring()
Sprite.springJoint()
getSpringRestLength ( )

get the distance between anchors at which the spring is at rest for a spring joint

See Also
setSpringRestLength
Sprite.springJoint()
getSpringStiffness ( )

get the stiffness for a rotary spring or a spring joint

See Also
setSpringStiffness
getSpringDamping
Sprite.rotarySpring()
Sprite.springJoint()
getSprite ( )

get the primary Sprite for the joint

When you create a joint in the PDG Engine, you do this by calling one of the Joint or Limit functions of a Sprite. The sprite that you called the Joint function for is the primary Sprite.

Note
The primary sprint is the one represented by the cpBody in Chipmunk retrieved calling cpConstraintGetA()
Returns
the primary Sprite in the joint
See Also
Sprite.gear()
Sprite.grooveJoint()
Sprite.motor()
Sprite.pinJoint()
Sprite.pivotJoint()
Sprite.ratchet()
Sprite.rotaryLimit()
Sprite.rotarySpring()
Sprite.slideJoint()
Sprite.springJoint()
getType ( )

returns a string for the type of joint

Returns
one of: "PinJoint", "SlideJoint", "PivotJoint", "GrooveJoint", "SpringJoint", "RotarySpring", "RotaryLimit", "Ratchet", "Gear", "Motor"
setAnchor ( Offset  inAnchor)

sets the anchor point for the joint on the primary sprite for pin, slide and spring joints

See Also
getAnchor
setOtherAnchor
Sprite.pinJoint()
Sprite.slideJoint()
Sprite.springJoint()
setErrorBias ( number  inErrorBias)

set the percentage of joint error than remains unfixed after one second

See Also
getErrorBias
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
setGearInitialAngle ( number  inGearInitialAngle)

set the initial angular offset between the two sprites joined with a gear joint

Note
This is referred to as "phase" in the Chipmunk docs and this call corresponds to cpGearJointSetPhase() in the Chipmunk API
See Also
getGearInitialAngle
setGearRatio
Sprite.gear()
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
setGearRatio ( number  inGearRatio)

set the ratio of rotation between the two sprites joined with a gear joint

See Also
getGearRatio
setGearInitialAngle
Sprite.gear()
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpConstraint
setGrooveEnd ( Offset  inGrooveEnd)

set the position on the primary sprite of the end of the groove for a groove joint

See Also
getGrooveEnd
setGrooveStart
Sprite.grooveJoint()
setGrooveStart ( Offset  inGrooveStart)

set the position on the primary sprite of the start of the groove for a groove joint

See Also
getGrooveStart
setGrooveEnd
Sprite.grooveJoint()
setMaxAngle ( number  inMaxAngle)

set the maximum angle allowed by a RotaryLimit joint

See Also
getMaxAngle
setMinAngle
Sprite.rotaryLimit()
setMaxBias ( number  inMaxBias)

set the maximum speed at which a joint can be error corrrected

See Also
getMaxBias
setMaxForce ( number  inMaxForce)

set the maximum force the joint can apply to the sprites

See Also
getMaxForce
setMinAngle ( number  inMinAngle)

set the minimum angle allowed by a RotaryLimit joint

See Also
getMinAngle
setMaxAngle
Sprite.rotaryLimit()
setMotorSpinRate ( number  inMotorSpinRate)

set how fast the sprites rotate relative to one another in a motor joint

See Also
getMotorSpinRate()
Sprite.motor()
setOtherAnchor ( Offset  inOtherAnchor)

sets the anchor point for the joint on the secondary sprite

See Also
getOtherAnchor
Sprite.grooveJoint()
Sprite.pinJoint()
Sprite.slideJoint()
Sprite.springJoint()
setPinDist ( number  inPinDist)

set the distance between the anchors on a pin joint

See Also
getPinDist
Sprite.pinJoint()
setRatchetAngle ( number  inRatchetAngle)

set the current angle of a ratchet joint

See Also
getRatchetAngle
setRatchetInterval
setRatchetPhase
Sprite.ratchet()
setRatchetInterval ( number  inRatchetInterval)

set the distance between backstops on a ratchet joint

See Also
getRatchetInterval
setRatchetAngle
setRatchetPhase
Sprite.ratchet()
setRatchetPhase ( number  inRatchetPhase)

set the initial offset for the ratchet backstops on a ratchet joint

See Also
getRatchetPhase
setRatchetAngle
setRatchetInterval
Sprite.ratchet()
setRotarySpringRestAngle ( number  inRotarySpringRestAngle)

set the angle between sprites at which a rotary spring is at rest on a rotary spring joint

See Also
getRotarySpringRestAngle
Sprite.rotarySpring()
setSlideMaxDist ( number  inSlideMaxDist)

set the maximum disable apart for the anchors of a slide joint

See Also
getSlideMaxDist
setSlideMinDist
Sprite.slideJoint()
setSlideMinDist ( number  inSlideMinDist)

set the minimum distance apart for the anchors of a slide joint

See Also
getSlideMinDist
setSlideMaxDist
Sprite.slideJoint()
setSpringDamping ( number  inSpringDamping)

set the damping for a rotary spring or a spring joint

See Also
getSpringDamping
setSpringStiffness
Sprite.rotarySpring()
Sprite.springJoint()
setSpringRestLength ( number  inSpringRestLength)

set the distance between anchors at which the spring is at rest for a spring joint

See Also
getSpringRestLength
Sprite.springJoint()
setSpringStiffness ( number  inSpringStiffness)

set the stiffness for a rotary spring or a spring joint

See Also
getSpringStiffness
setSpringDamping
Sprite.rotarySpring()
Sprite.springJoint()

User Comments