MCPcopy Create free account
hub / github.com/ByteArena/box2d / MakeB2RopeJoint

Function MakeB2RopeJoint

DynamicsB2JointRope.go:95–111  ·  view source on GitHub ↗

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

(def *B2RopeJointDef)

Source from the content-addressed store, hash-verified

93// // = invMassA + invIA * cross(rA, u)^2 + invMassB + invIB * cross(rB, u)^2
94
95func MakeB2RopeJoint(def *B2RopeJointDef) *B2RopeJoint {
96 res := B2RopeJoint{
97 B2Joint: MakeB2Joint(def),
98 }
99
100 res.M_localAnchorA = def.LocalAnchorA
101 res.M_localAnchorB = def.LocalAnchorB
102
103 res.M_maxLength = def.MaxLength
104
105 res.M_mass = 0.0
106 res.M_impulse = 0.0
107 res.M_state = B2LimitState.E_inactiveLimit
108 res.M_length = 0.0
109
110 return &res
111}
112
113func (joint *B2RopeJoint) InitVelocityConstraints(data B2SolverData) {
114 joint.M_indexA = joint.M_bodyA.M_islandIndex

Callers 1

B2JointCreateFunction · 0.85

Calls 1

MakeB2JointFunction · 0.85

Tested by

no test coverage detected