GetAnchorB() public abstract method

get the anchor point on bodyB in world coordinates.
public abstract GetAnchorB ( Vec2 argOut ) : void
argOut Box2D.Common.Vec2
return void
Ejemplo n.º 1
0
        private void DrawJoint(Joint joint)
        {
            Body bodyA = joint.BodyA;
            Body bodyB = joint.BodyB;
            Transform xf1 = bodyA.GetTransform();
            Transform xf2 = bodyB.GetTransform();
            Vec2 x1 = xf1.P;
            Vec2 x2 = xf2.P;
            Vec2 p1 = Pool.PopVec2();
            Vec2 p2 = Pool.PopVec2();
            joint.GetAnchorA(p1);
            joint.GetAnchorB(p2);

            color.Set(0.5f, 0.8f, 0.8f);

            switch (joint.Type)
            {

                // TODO djm write after writing joints
                case JointType.Distance:
                    DebugDraw.DrawSegment(p1, p2, color);
                    break;

                case JointType.Pulley:
                    {
                        PulleyJoint pulley = (PulleyJoint)joint;
                        Vec2 s1 = pulley.GroundAnchorA;
                        Vec2 s2 = pulley.GroundAnchorB;
                        DebugDraw.DrawSegment(s1, p1, color);
                        DebugDraw.DrawSegment(s2, p2, color);
                        DebugDraw.DrawSegment(s1, s2, color);
                    }
                    break;

                case JointType.ConstantVolume:
                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;

            }
            Pool.PushVec2(2);
        }