/// <summary> /// Initialize the bodies, anchors, and reference angle using the world /// anchor. /// </summary> public void Initialize(Body body1, Body body2, Vector2 anchor) { Body1 = body1; Body2 = body2; LocalAnchor1 = body1.GetLocalPoint(anchor); LocalAnchor2 = body2.GetLocalPoint(anchor); ReferenceAngle = body2.GetAngle() - body1.GetAngle(); }
public void Initialize(Body body1, Body body2, Vec2 anchor) { this.Body1 = body1; this.Body2 = body2; this.LocalAnchor1 = body1.GetLocalPoint(anchor); this.LocalAnchor2 = body2.GetLocalPoint(anchor); this.ReferenceAngle = body2.GetAngle() - body1.GetAngle(); }
private Vec2 CalcPoleEndPos(Body poleBody) { // Determine position of top of pole relative to its center of mass. float angle = poleBody.GetAngle(); Vec2 polePosTopRelative = new Vec2(__ArmLength * (float)-SysMath.Sin(angle), __ArmLength * (float)SysMath.Cos(angle)); return poleBody.GetPosition() + (polePosTopRelative * 0.5f); }
/// <summary> /// Initialize the bodies, anchors, axis, and reference angle using the world /// anchor and world axis. /// </summary> public void Initialize(Body body1, Body body2, Vector2 anchor, Vector2 axis) { Body1 = body1; Body2 = body2; LocalAnchor1 = body1.GetLocalPoint(anchor); LocalAnchor2 = body2.GetLocalPoint(anchor); LocalAxis1 = body1.GetLocalVector(axis); ReferenceAngle = body2.GetAngle() - body1.GetAngle(); }