Esempio n. 1
0
        protected override void CopyTo(JointInfo target)
        {
            base.CopyTo(target);
            FixedPrismaticJointInfo c = target as FixedPrismaticJointInfo;

            c.worldAnchor   = this.worldAnchor;
            c.moveAxis      = this.moveAxis;
            c.refAngle      = this.refAngle;
            c.limitEnabled  = this.limitEnabled;
            c.lowerLimit    = this.lowerLimit;
            c.upperLimit    = this.upperLimit;
            c.motorEnabled  = this.motorEnabled;
            c.motorSpeed    = this.motorSpeed;
            c.maxMotorForce = this.maxMotorForce;
        }
        private void DrawJoint(Canvas canvas, FixedPrismaticJointInfo joint)
        {
            float angularCircleRad = joint.BodyA.BoundRadius * 0.25f;

            if (joint.LimitEnabled)
                this.DrawWorldAxisConstraint(canvas, joint.BodyA, joint.MovementAxis, Vector2.Zero, joint.WorldAnchor, joint.LowerLimit, joint.UpperLimit);
            else
                this.DrawWorldAxisConstraint(canvas, joint.BodyA, joint.MovementAxis, Vector2.Zero, joint.WorldAnchor);

            this.DrawLocalAngleConstraint(canvas, joint.BodyA, Vector2.Zero, joint.ReferenceAngle, joint.BodyA.GameObj.Transform.Angle, joint.BodyA.BoundRadius);

            if (joint.MotorEnabled)
                this.DrawWorldAxisMotor(canvas, joint.BodyA, joint.MovementAxis, Vector2.Zero, joint.WorldAnchor, joint.MotorSpeed, joint.MaxMotorForce, joint.BodyA.BoundRadius * 1.15f);

            this.DrawWorldAnchor(canvas, joint.BodyA, joint.WorldAnchor);
        }