예제 #1
0
        private void DrawJoint(Canvas canvas, LineJointInfo joint)
        {
            Vector2 anchorAToWorld = joint.ParentBody.GameObj.Transform.GetWorldPoint(joint.CarAnchor);

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

            if (joint.MotorEnabled)
            {
                this.DrawLocalAngleMotor(canvas, joint.OtherBody, Vector2.Zero, joint.MotorSpeed, joint.MaxMotorTorque, joint.OtherBody.BoundRadius * 1.15f);
            }
        }
예제 #2
0
        private void DrawJoint(Canvas canvas, LineJointInfo joint)
        {
            Vector2 anchorAToWorld = joint.ParentBody.GameObj.Transform.GetWorldPoint(joint.CarAnchor);

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

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

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