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

Method Initialize

DynamicsB2JointMotor.go:85–94  ·  view source on GitHub ↗

Point-to-point constraint Cdot = v2 - v1 = v2 + cross(w2, r2) - v1 - cross(w1, r1) J = [-I -r1_skew I r2_skew ] Identity used: w k % (rx i + ry j) = w * (-ry i + rx j) r1 = offset - c1 r2 = -c2 Angle constraint Cdot = w2 - w1 J = [0 0 -1 0 0 1] K = invI1 + invI2

(bA *B2Body, bB *B2Body)

Source from the content-addressed store, hash-verified

83// K = invI1 + invI2
84
85func (def *B2MotorJointDef) Initialize(bA *B2Body, bB *B2Body) {
86 def.BodyA = bA
87 def.BodyB = bB
88 xB := def.BodyB.GetPosition()
89 def.LinearOffset = def.BodyA.GetLocalPoint(xB)
90
91 angleA := def.BodyA.GetAngle()
92 angleB := def.BodyB.GetAngle()
93 def.AngularOffset = angleB - angleA
94}
95
96func MakeB2MotorJoint(def *B2MotorJointDef) *B2MotorJoint {
97

Callers

nothing calls this directly

Calls 3

GetPositionMethod · 0.80
GetLocalPointMethod · 0.80
GetAngleMethod · 0.45

Tested by

no test coverage detected