public AngularSpring(Body body1, Body body2,float springConstant, float dampningConstant) { _body1 = body1; _body2 = body2; this.springConstant = springConstant; this.dampningConstant = dampningConstant; targetAngle = GetAngle(); }
public LinearSpring(Body body1, Vector2 attachPoint1, Body body2, Vector2 attachPoint2, float springConstant, float dampningConstant) { _body1 = body1; _body2 = body2; this.attachPoint1 = attachPoint1; this.attachPoint2 = attachPoint2; this.springConstant = springConstant; this.dampningConstant = dampningConstant; Vector2 difference = body2.GetWorldPosition(attachPoint2) - body1.GetWorldPosition(attachPoint1); restLength = difference.Length(); }
public RevoluteJoint(Body body1, Body body2, Vector2 anchor) { this._body1 = body1; this._body2 = body2; //Matrix rotation1 localAnchor1 = body1.GetLocalPosition(anchor); localAnchor2 = body2.GetLocalPosition(anchor); accumulatedImpulse = Vector2.Zero; relaxation = 1f; }