Example #1
0
        protected override void CopyTo(JointInfo target)
        {
            base.CopyTo(target);
            WeldJointInfo c = target as WeldJointInfo;

            c.localAnchorA = this.localAnchorA;
            c.localAnchorB = this.localAnchorB;
            c.refAngle     = this.refAngle;
        }
        private void DrawJoint(Canvas canvas, WeldJointInfo 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);

            this.DrawLocalAnchor(canvas, joint.BodyA, joint.LocalAnchorA);
            this.DrawLocalAnchor(canvas, joint.BodyB, joint.LocalAnchorB);

            this.DrawLocalAngleConstraint(canvas,
                joint.BodyA,
                joint.LocalAnchorA,
                joint.BodyB.GameObj.Transform.Angle - joint.RefAngle,
                joint.BodyA.GameObj.Transform.Angle,
                angularCircleRadA);
            if (displaySecondCollider)
            {
                this.DrawLocalAngleConstraint(canvas,
                    joint.BodyB,
                    joint.LocalAnchorB,
                    joint.BodyA.GameObj.Transform.Angle + joint.RefAngle,
                    joint.BodyB.GameObj.Transform.Angle,
                    angularCircleRadB);
            }
        }