/// <summary> /// ��ʼ�� /// </summary> protected override void Initialize() { /* �������100fps */ IsFixedTimeStep = true; /* 1������Ⱦ100fps */ TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 1); /* ��ʼ����������ȫ�֣�����Ϊ9.8�������� */ physicsSimulator = new PhysicsSimulator(new Vector2(0f, 1000f)); /* ����Ħ��Ϊƽ��ֵ */ //physicsSimulator.FrictionType = FrictionType.Minimum; /* ��ʼ�������ε�ռλ��������С����������λ�� */ //boxBody1 = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 50, 50, 79 * 50 * 50); //boxBody1.Position = new Vector2(400, 100); /* ���ü��ٱ��� */ //boxBody1.LinearDragCoefficient = 1.5f; /* �������ι̶��ڳ�ʼ���� */ //boxBody1.IsStatic = true; /* ��ʼ����������ײ��� */ //boxGeometry1 = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, boxBody1, 50, 50); /* ��ʼ��Բ�ε�ռλ��������С����������λ�� */ boxBody2 = BodyFactory.Instance.CreateCircleBody(physicsSimulator, 25, 1); boxBody2.Position = new Vector2(400, 400); /* ���ٱ��� */ boxBody2.LinearDragCoefficient = 0.9f; /* ���м��ٱ��� */ boxBody2.LinearVelocity = new Vector2(10f); /* ��ת�ٱ��� */ boxBody2.RotationalDragCoefficient = 25f; /* ��ʼ����������ײ��� */ boxGeometry2 = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, boxBody2, 25, 60); /* ��ʼ����ص�ռλ��������С����������λ�� */ boxBody3 = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 1440, 10, 79f * (4 / 3 * 3.1416f * 25 * 25 * 25)); boxBody3.Position = new Vector2(500, 580); boxBody3.LinearDragCoefficient = 0.9f; /* ����ع̶��ڳ�ʼ���� */ boxBody3.IsStatic = true; /* ��ʼ�������ײ��� */ boxGeometry3 = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, boxBody3, 1440, 10); /* �������κ�Բ�����������������Ϊ300����С����Ϊ50 */ //sliderJoint = JointFactory.Instance.CreateSliderJoint(physicsSimulator, // boxBody1, new Vector2(25, 25), boxBody2, new Vector2(25, 25), 50, 300); gex = new GraphicsEx(this); gex.LoadContent(); /* ���ɼ� */ IsMouseVisible = true; base.Initialize(); }