b2RopeJoint Class
A rope joint enforces a maximum distance between two points on two bodies. It has no other effect.
Warning: if you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so I chose not to implement it that way. See b2DistanceJoint if you want to dynamically control length.
Constructor
b2RopeJoint
-
ropeJointDef
Parameters:
-
ropeJointDef
B2RopeJointDef
Example:
Limit: C = norm(pB - pA) - L u = (pB - pA) / norm(pB - pA) Cdot = dot(u, vB + cross(wB, rB) - vA - cross(wA, rA)) J = [-u -cross(rA, u) u cross(rB, u)] K = J invM JT = invMassA + invIA cross(rA, u)^2 + invMassB + invIB cross(rB, u)^2
Item Index
Methods
- getAnchorA
- getAnchorB
- getLimitState
- getLocalAnchorA
- getLocalAnchorB
- getMaxLength
- getReactionForce
- getReactionTorque
- initVelocityConstraints
- setMaxLength
- solvePositionConstraints
- solveVelocityConstraints
- create static
- destroy static
- getAnchorA
- getAnchorB
- getBodyA
- getBodyB
- getCollideConnected
- getNext
- getReactionForce
- getReactionTorque
- getType
- getUserData
- initVelocityConstraints
- isActive
- setUserData
- shiftOrigin
- solveVelocityConstraints
- solveVelocityConstraints
Properties
- m_bias
- m_frequencyHz
- m_gamma
- m_impulse
- m_indexA
- m_indexB
- m_invMassB
- m_invMassB
- m_lalcA
- m_lalcB
- m_length
- m_localAnchorA
- m_localAnchorB
- m_localCenterA
- m_localCenterB
- m_mass
- m_maxLength
- m_maxLength
- m_qA
- m_qA
- m_qB
- m_rA
- m_rB
- m_state
- m_state
- m_u
- m_bodyA
- m_bodyB
- m_collideConnected
- m_edgeA
- m_edgeB
- m_index
- m_islandFlag
- m_next
- m_prev
- m_type
- m_userData
- ParentClass
Methods
getAnchorA
-
[out=b2Vec2]
Parameters:
-
[out=b2Vec2]
B2Vec2 | Object= optionalreusable object
Returns:
out
getAnchorB
-
[out=b2Vec2]
Parameters:
-
[out=b2Vec2]
B2Vec2 | Object= optionalreusable object
Returns:
out
getLimitState
()
Int
public
Returns:
getLocalAnchorA
-
[out=b2Vec2]
The local anchor point relative to bodyA's origin.
Parameters:
-
[out=b2Vec2]
B2Vec2 | Object= optionalreusable object
Returns:
out
getLocalAnchorB
-
[out=b2Vec2]
The local anchor point relative to bodyB's origin.
Parameters:
-
[out=b2Vec2]
B2Vec2 | Object= optionalreusable object
Returns:
out
getMaxLength
()
Float
public
Get the maximum length of the rope.
Returns:
getReactionForce
-
invDeltaTime
-
[out=b2Vec2]
Get the reaction force given the inverse time step. Unit is N.
Parameters:
-
invDeltaTime
Float -
[out=b2Vec2]
B2Vec2 | Object= optionalreusable object
Returns:
out
getReactionTorque
-
invDeltaTime
Get the reaction torque given the inverse time step. Unit is N*m. This is always zero for a distance joint.
Parameters:
-
invDeltaTime
Float
Returns:
initVelocityConstraints
-
data
Parameters:
-
data
B2SolverData
Returns:
setMaxLength
-
length
Set the maximum length of the rope.
Parameters:
-
length
Float
Returns:
solvePositionConstraints
-
data
Parameters:
-
data
B2SolverData
Returns:
solveVelocityConstraints
-
data
Parameters:
-
data
B2SolverData
Returns:
Properties
m_bias
Float
public
Default: (0,0)
m_frequencyHz
Float
public
Default: {b2ropeDef.frequencyHz} 0.0
m_gamma
Float
public
Default: (0,0)
m_impulse
Float
public
Default: 0.0
m_indexA
Int
public
Default: 0
m_indexB
Int
public
Default: 0
m_invMassB
Int
public
Default: 0.0
m_invMassB
Int
public
Default: 0
m_lalcA
B2Vec2
public
m_lalcB
B2Vec2
public
m_length
Float
public
Default: {b2ropeDef.length} 1.0
m_localAnchorA
B2Vec2
public
Default: {b2ropeDef.localAnchorB} (0,0)
m_localAnchorB
B2Vec2
public
Default: {b2ropeDef.localAnchorB} (0,0)
m_localCenterA
B2Vec2
public
m_localCenterB
B2Vec2
public
m_mass
Float
protected
Default: 0.0
m_maxLength
Float
public
Default: {b2ropeDef.maxLength} 0.0
m_maxLength
Float
public
Default: 0.0
m_qA
B2Rot
public
m_qA
B2Rot
public
m_qB
B2Rot
public
m_rA
B2Vec2
public
m_rB
B2Vec2
public
m_state
Int
public
Default: b2Joint.e_inactiveLimit
m_state
Float
protected
Default: b2Joint.e_inactiveLimit