protected override void CopyTo(JointInfo target) { base.CopyTo(target); RevoluteJointInfo c = target as RevoluteJointInfo; c.localAnchorB = this.localAnchorB; c.localAnchorA = this.localAnchorA; c.motorSpeed = this.motorSpeed; c.maxMotorTorque = this.maxMotorTorque; c.motorEnabled = this.motorEnabled; c.limitEnabled = this.limitEnabled; c.lowerLimit = this.lowerLimit; c.upperLimit = this.upperLimit; c.refAngle = this.refAngle; }
private void DrawJoint(Canvas canvas, RevoluteJointInfo joint) { float angularCircleRadA = joint.BodyA.BoundRadius * 0.25f; float angularCircleRadB = joint.BodyB.BoundRadius * 0.25f; float anchorDist = this.GetAnchorDist(joint.BodyA, joint.BodyB, joint.LocalAnchorA, joint.LocalAnchorB); bool displaySecondCollider = anchorDist >= angularCircleRadA + angularCircleRadB; this.DrawLocalPosConstraint(canvas, joint.BodyA, joint.BodyB, joint.LocalAnchorA, joint.LocalAnchorB); if (joint.LimitEnabled) { this.DrawLocalAngleConstraint(canvas, joint.BodyA, joint.LocalAnchorA, joint.BodyB.GameObj.Transform.Angle - joint.ReferenceAngle, joint.BodyA.GameObj.Transform.Angle, angularCircleRadA); if (displaySecondCollider) { this.DrawLocalAngleConstraint(canvas, joint.BodyB, joint.LocalAnchorB, joint.BodyA.GameObj.Transform.Angle + joint.ReferenceAngle, joint.BodyB.GameObj.Transform.Angle, angularCircleRadB); } } if (joint.MotorEnabled) { this.DrawLocalAngleMotor(canvas, joint.BodyA, Vector2.Zero, joint.MotorSpeed, joint.MaxMotorTorque, joint.BodyA.BoundRadius * 1.15f); } this.DrawLocalAnchor(canvas, joint.BodyA, joint.LocalAnchorA); this.DrawLocalAnchor(canvas, joint.BodyB, joint.LocalAnchorB); }