static void drawJoint(FSDebugView instance, Joint joint) { if (!joint.enabled) { return; } var b1 = joint.bodyA; var b2 = joint.bodyB; FarseerPhysics.Common.Transform xf1; b1.getTransform(out xf1); var x2 = Vector2.Zero; if (b2 != null || !joint.isFixedType()) { FarseerPhysics.Common.Transform xf2; b2.getTransform(out xf2); x2 = xf2.p; } var p1 = joint.worldAnchorA; var p2 = joint.worldAnchorB; var x1 = xf1.p; var color = new Color(0.5f, 0.8f, 0.8f); switch (joint.jointType) { case JointType.Distance: { instance.drawSegment(p1, p2, color); break; } case JointType.Pulley: { var pulley = (PulleyJoint)joint; var s1 = b1.getWorldPoint(pulley.localAnchorA); var s2 = b2.getWorldPoint(pulley.localAnchorB); instance.drawSegment(p1, p2, color); instance.drawSegment(p1, s1, color); instance.drawSegment(p2, s2, color); break; } case JointType.FixedMouse: { instance.drawPoint(p1, 0.2f, new Color(0.0f, 1.0f, 0.0f)); instance.drawSegment(p1, p2, new Color(0.8f, 0.8f, 0.8f)); break; } case JointType.Revolute: { instance.drawSegment(x1, p1, color); instance.drawSegment(p1, p2, color); instance.drawSegment(x2, p2, color); instance.drawSolidCircle(p2, 0.1f, Vector2.Zero, Color.Red); instance.drawSolidCircle(p1, 0.1f, Vector2.Zero, Color.Blue); break; } case JointType.Gear: { instance.drawSegment(x1, x2, color); break; } default: { instance.drawSegment(x1, p1, color); instance.drawSegment(p1, p2, color); instance.drawSegment(x2, p2, color); break; } } }
static void drawJoint( FSDebugView instance, Joint joint ) { if( !joint.enabled ) return; var b1 = joint.bodyA; var b2 = joint.bodyB; FarseerPhysics.Common.Transform xf1; b1.getTransform( out xf1 ); var x2 = Vector2.Zero; if( b2 != null || !joint.isFixedType() ) { FarseerPhysics.Common.Transform xf2; b2.getTransform( out xf2 ); x2 = xf2.p; } var p1 = joint.worldAnchorA; var p2 = joint.worldAnchorB; var x1 = xf1.p; var color = new Color( 0.5f, 0.8f, 0.8f ); switch( joint.jointType ) { case JointType.Distance: { instance.drawSegment( p1, p2, color ); break; } case JointType.Pulley: { var pulley = (PulleyJoint)joint; var s1 = b1.getWorldPoint( pulley.localAnchorA ); var s2 = b2.getWorldPoint( pulley.localAnchorB ); instance.drawSegment( p1, p2, color ); instance.drawSegment( p1, s1, color ); instance.drawSegment( p2, s2, color ); break; } case JointType.FixedMouse: { instance.drawPoint( p1, 0.2f, new Color( 0.0f, 1.0f, 0.0f ) ); instance.drawSegment( p1, p2, new Color( 0.8f, 0.8f, 0.8f ) ); break; } case JointType.Revolute: { instance.drawSegment( x1, p1, color ); instance.drawSegment( p1, p2, color ); instance.drawSegment( x2, p2, color ); instance.drawSolidCircle( p2, 0.1f, Vector2.Zero, Color.Red ); instance.drawSolidCircle( p1, 0.1f, Vector2.Zero, Color.Blue ); break; } case JointType.Gear: { instance.drawSegment( x1, x2, color ); break; } default: { instance.drawSegment( x1, p1, color ); instance.drawSegment( p1, p2, color ); instance.drawSegment( x2, p2, color ); break; } } }