1-D constrained system m (v2 - v1) = lambda v2 + (beta/h) * x1 + gamma * lambda = 0, gamma has units of inverse mass. x2 = x1 + h * v2 1-D mass-damper-spring system m (v2 - v1) + h * d * v2 + h * k * C = norm(p2 - p1) - L u = (p2 - p1) / norm(p2 - p1) Cdot = dot(u, v2 + cross(w2, r2) - v1 - cross(w1
(b1 *B2Body, b2 *B2Body, anchor1 B2Vec2, anchor2 B2Vec2)
| 128 | // = invMass1 + invI1 * cross(r1, u)^2 + invMass2 + invI2 * cross(r2, u)^2 |
| 129 | |
| 130 | func (joint *B2DistanceJointDef) Initialize(b1 *B2Body, b2 *B2Body, anchor1 B2Vec2, anchor2 B2Vec2) { |
| 131 | joint.BodyA = b1 |
| 132 | joint.BodyB = b2 |
| 133 | joint.LocalAnchorA = joint.BodyA.GetLocalPoint(anchor1) |
| 134 | joint.LocalAnchorB = joint.BodyB.GetLocalPoint(anchor2) |
| 135 | d := B2Vec2Sub(anchor2, anchor1) |
| 136 | joint.Length = d.Length() |
| 137 | } |
| 138 | |
| 139 | func MakeB2DistanceJoint(def *B2DistanceJointDef) *B2DistanceJoint { |
| 140 | res := B2DistanceJoint{ |
nothing calls this directly
no test coverage detected