new Joint(spriteA, spriteB, typeopt)
Using this Joint class directly is not recommended, but
if it is used a GlueJoint will be created.
It's better to use a specific joint class constructor:
GlueJoint, DistanceJoint, WheelJoint, HingeJoint,
SliderJoint, or RopeJoint.
All other joint classes extend this class. Joint type
can not be changed after a joint is created.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
spriteA |
Sprite
|
||
spriteB |
Sprite
|
||
type |
String
|
<optional> |
Classes
Members
collideConnected :Boolean
Set to true if you want the joint's sprites to collide with
each other.
Type:
-
Boolean
damping :Number
Damping only effects joint's that have a
springiness greater than 0.
Damping is a 0-1 ratio describing how quickly the joint loses
vibrational energy.
0.0 lets the joint continue to spring up and down very easily.
1.0 makes the joint lose vibrational energy immediately,
making the joint completely rigid, regardless of its springiness.
Type:
-
Number
draw :function
Function that draws the joint. Can be overridden by the user.
Type:
-
function
enableMotor :Boolean
Enable or disable the joint's motor.
Disabling the motor is like putting a
car in neutral.
Type:
-
Boolean
maxPower :Number
Max power is how the amount of torque a joint motor can exert
around its axis of rotation.
Type:
-
Number
offsetA :p5.Vector
Offset to the joint's anchorA position from the center of spriteA.
Only distance and hinge joints have an offsetA.
Type:
-
p5.Vector
offsetB :p5.Vector
Offset to the joint's anchorB position from the center of spriteB.
Only distance, hinge, and wheel joints have an offsetB.
Type:
-
p5.Vector
power :Number
Read only. The joint's current power, the amount of torque
being applied on the joint's axis of rotation.
Type:
-
Number
speed :Number
The current speed of the joint's motor.
Type:
-
Number
springiness :Number
The springiness of the joint, a 0-1 ratio.
0.0 makes the joint completely rigid, and
1.0 turns the joint into a super loose spring,
like a broken slinky that was overextended.
Springiness is a user friendly wrapper around Box2D's spring
frequency joint parameter. It's 0-1 ratio is piecewise mapped
to the range of 30-0.2hz, except 0 remains 0.
0.0 -> 0hz (perfectly rigid)
>0.0-0.1 -> 30hz-4hz (steel rod)
0.1-0.5 -> 4hz-2.5hz (tight spring)
0.5-0.8 -> 2.5hz-1hz (bouncy spring)
0.8-0.9 -> 1hz-0.5hz (slinky)
0.9-1.0 -> 0.5hz-0.2hz (bungee cord)
Type:
-
Number