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

            c.localAnchorB   = this.localAnchorB;
            c.localAnchorA   = this.localAnchorA;
            c.motorSpeed     = this.motorSpeed;
            c.maxMotorTorque = this.maxMotorTorque;
            c.moveAxis       = this.moveAxis;
            c.motorEnabled   = this.motorEnabled;
            c.dampingRatio   = this.dampingRatio;
            c.frequency      = this.frequency;
        }
        private void DrawJoint(Canvas canvas, LineJointInfo joint)
        {
            Vector2 anchorAToWorld = joint.BodyA.GameObj.Transform.GetWorldPoint(joint.CarAnchor);

            this.DrawWorldPosConstraint(canvas, joint.BodyA, joint.CarAnchor, anchorAToWorld);
            this.DrawLocalAxisConstraint(canvas, joint.BodyB, joint.BodyA, joint.MovementAxis, joint.WheelAnchor, joint.CarAnchor, -joint.BodyB.BoundRadius * 0.25f, joint.BodyB.BoundRadius * 0.25f);
            this.DrawLocalAnchor(canvas, joint.BodyA, joint.CarAnchor);
            this.DrawLocalAnchor(canvas, joint.BodyB, joint.WheelAnchor);

            canvas.State.SetMaterial(new BatchInfo(DrawTechnique.Alpha, this.JointColor));
            this.DrawLocalText(canvas, joint.BodyA, "Car", Vector2.Zero, 0.0f);
            this.DrawLocalText(canvas, joint.BodyB, "Wheel", Vector2.Zero, 0.0f);

            if (joint.MotorEnabled)
            {
                this.DrawLocalAngleMotor(canvas, joint.BodyB, Vector2.Zero, joint.MotorSpeed, joint.MaxMotorTorque, joint.BodyB.BoundRadius * 1.15f);
            }
        }