Box2DX.Dynamics.Joint.GetBody1 C# (CSharp) Method

GetBody1() public method

Get the first body attached to this joint.
public GetBody1 ( ) : Body
return Body
		public Body GetBody1()
		{
			return _body1;
		}

Usage Example

示例#1
0
文件: World.cs 项目: vb0067/LGame
        private void DrawJoint(Joint joint)
        {
            Body      b1  = joint.GetBody1();
            Body      b2  = joint.GetBody2();
            Transform xf1 = b1.GetTransform();
            Transform xf2 = b2.GetTransform();
            Vec2      x1  = xf1.Position;
            Vec2      x2  = xf2.Position;
            Vec2      p1  = joint.Anchor1;
            Vec2      p2  = joint.Anchor2;

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

            switch (joint.GetType())
            {
            case JointType.DistanceJoint:
                _debugDraw.DrawSegment(p1, p2, color);
                break;

            case JointType.PulleyJoint:
            {
                PulleyJoint pulley = (PulleyJoint)joint;
                Vec2        s1     = pulley.GroundAnchor1;
                Vec2        s2     = pulley.GroundAnchor2;
                _debugDraw.DrawSegment(s1, p1, color);
                _debugDraw.DrawSegment(s2, p2, color);
                _debugDraw.DrawSegment(s1, s2, color);
            }
            break;

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

            default:
                _debugDraw.DrawSegment(x1, p1, color);
                _debugDraw.DrawSegment(p1, p2, color);
                _debugDraw.DrawSegment(x2, p2, color);
                break;
            }
        }
All Usage Examples Of Box2DX.Dynamics.Joint::GetBody1