Ejemplo n.º 1
0
        void DrawJoint(Joint joint)
        {
            Body      b1 = joint.GetBodyA();
            Body      b2 = joint.GetBodyB();
            Transform xf1, xf2;

            b1.GetTransform(out xf1);
            b2.GetTransform(out xf2);
            Vector2 x1 = xf1.Position;
            Vector2 x2 = xf2.Position;
            Vector2 p1 = joint.GetAnchorA();
            Vector2 p2 = joint.GetAnchorB();

            Color color = new Color(0.5f, 0.8f, 0.8f);

            switch (joint.JointType)
            {
            case JointType.Distance:
                DebugDraw.DrawSegment(p1, p2, color);
                break;

            case JointType.Pulley:
            {
                PulleyJoint pulley = (PulleyJoint)joint;
                Vector2     s1     = pulley.GetGroundAnchorA();
                Vector2     s2     = pulley.GetGroundAnchorB();
                DebugDraw.DrawSegment(s1, p1, color);
                DebugDraw.DrawSegment(s2, p2, color);
                DebugDraw.DrawSegment(s1, s2, color);
            }
            break;

            case JointType.Mouse:
                // don't draw this
                break;

            default:
                DebugDraw.DrawSegment(x1, p1, color);
                DebugDraw.DrawSegment(p1, p2, color);
                DebugDraw.DrawSegment(x2, p2, color);
                break;
            }
        }
Ejemplo n.º 2
0
        private void DrawJoint(Joint joint)
        {
            Body      bodyA = joint.GetBodyA();
            Body      bodyB = joint.GetBodyB();
            Transform xf1   = bodyA.GetTransform();
            Transform xf2   = bodyB.GetTransform();
            Vec2      x1    = xf1.p;
            Vec2      x2    = xf2.p;
            Vec2      p1    = joint.GetAnchorA();
            Vec2      p2    = joint.GetAnchorB();

            Color color = Color.FromArgb(128, 200, 200);

            switch (joint.GetJointType())
            {
            case JointType.e_distanceJoint:
                m_debugDraw.DrawSegment(p1, p2, color);
                break;

            case JointType.e_pulleyJoint:
            {
                throw new NotImplementedException();
                //PulleyJoint pulley = (PulleyJoint)joint;
                //Vec2 s1 = pulley.GetGroundAnchorA();
                //Vec2 s2 = pulley.GetGroundAnchorB();
                //m_debugDraw.DrawSegment(s1, p1, color);
                //m_debugDraw.DrawSegment(s2, p2, color);
                //m_debugDraw.DrawSegment(s1, s2, color);
            }
            break;

            case JointType.e_mouseJoint:
                // don't draw this
                break;

            default:
                m_debugDraw.DrawSegment(x1, p1, color);
                m_debugDraw.DrawSegment(p1, p2, color);
                m_debugDraw.DrawSegment(x2, p2, color);
                break;
            }
        }
Ejemplo n.º 3
0
		private void DrawJoint(Joint joint)
		{
			Body bodyA = joint.GetBodyA();
			Body bodyB = joint.GetBodyB();
			Transform xf1 = bodyA.GetTransform();
			Transform xf2 = bodyB.GetTransform();
			Vec2 x1 = xf1.p;
			Vec2 x2 = xf2.p;
			Vec2 p1 = joint.GetAnchorA();
			Vec2 p2 = joint.GetAnchorB();

			Color color = Color.FromArgb(128, 200, 200);

			switch (joint.GetJointType())
			{
			case JointType.e_distanceJoint:
			    m_debugDraw.DrawSegment(p1, p2, color);
			    break;

			case JointType.e_pulleyJoint:
			    {
					throw new NotImplementedException();
					//PulleyJoint pulley = (PulleyJoint)joint;
					//Vec2 s1 = pulley.GetGroundAnchorA();
					//Vec2 s2 = pulley.GetGroundAnchorB();
					//m_debugDraw.DrawSegment(s1, p1, color);
					//m_debugDraw.DrawSegment(s2, p2, color);
					//m_debugDraw.DrawSegment(s1, s2, color);
			    }
			    break;

			case JointType.e_mouseJoint:
			    // don't draw this
			    break;

			default:
			    m_debugDraw.DrawSegment(x1, p1, color);
			    m_debugDraw.DrawSegment(p1, p2, color);
			    m_debugDraw.DrawSegment(x2, p2, color);
				break;
			}
		}