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

Method Initialize

DynamicsB2JointPrismatic.go:201–208  ·  view source on GitHub ↗

Linear constraint (point-to-line) d = p2 - p1 = x2 + r2 - x1 - r1 C = dot(perp, d) Cdot = dot(d, cross(w1, perp)) + dot(perp, v2 + cross(w2, r2) - v1 - cross(w1, r1)) = -dot(perp, v1) - dot(cross(d + r1, perp), w1) + dot(perp, v2) + dot(cross(r2, perp), v2) J = [-perp, -cross(d + r1, perp), perp, cr

(bA *B2Body, bB *B2Body, anchor B2Vec2, axis B2Vec2)

Source from the content-addressed store, hash-verified

199// df = f2 - f1
200
201func (joint *B2PrismaticJointDef) Initialize(bA *B2Body, bB *B2Body, anchor B2Vec2, axis B2Vec2) {
202 joint.BodyA = bA
203 joint.BodyB = bB
204 joint.LocalAnchorA = joint.BodyA.GetLocalPoint(anchor)
205 joint.LocalAnchorB = joint.BodyB.GetLocalPoint(anchor)
206 joint.LocalAxisA = joint.BodyA.GetLocalVector(axis)
207 joint.ReferenceAngle = joint.BodyB.GetAngle() - joint.BodyA.GetAngle()
208}
209
210func MakeB2PrismaticJoint(def *B2PrismaticJointDef) *B2PrismaticJoint {
211 res := B2PrismaticJoint{

Callers

nothing calls this directly

Calls 3

GetLocalPointMethod · 0.80
GetLocalVectorMethod · 0.80
GetAngleMethod · 0.45

Tested by

no test coverage detected