Ok so I made a few classes to make things easier, but when I try to use a body from the class, xcode enters the debugger, and stops at one point. It normally doesn't do this, and goes strait to the game.
The code for box2D is here:
Rect/Circle Factories both have : b2Body* body in them, so rect/circle.body should work for both of them.
So then why wont this work, anyone know?
The code for box2D is here:
Code:
RectFactory rect(-270.0f, 240.0f, 200.0f, 200.0f, 1.0f, world);
RectFactory groundRect(0.0f, -300.0f, 3000.0f, 600.0f, 0.0f, world);
CircleFactory circle(270.0f, 240.0f, 100.0f, 1.0f, world);
b2Body* rectBody = rect.body;
b2Body* circleBody = circle.body;
b2DistanceJointDef jointDef;
jointDef.Initialize(rectBody, circleBody, rectBody->GetPosition(), circleBody->GetPosition());
jointDef.collideConnected = true;
b2DistanceJoint* joint = (b2DistanceJoint*)world->CreateJoint(&jointDef);
RectFactory groundRect(0.0f, -300.0f, 3000.0f, 600.0f, 0.0f, world);
CircleFactory circle(270.0f, 240.0f, 100.0f, 1.0f, world);
b2Body* rectBody = rect.body;
b2Body* circleBody = circle.body;
b2DistanceJointDef jointDef;
jointDef.Initialize(rectBody, circleBody, rectBody->GetPosition(), circleBody->GetPosition());
jointDef.collideConnected = true;
b2DistanceJoint* joint = (b2DistanceJoint*)world->CreateJoint(&jointDef);
Rect/Circle Factories both have : b2Body* body in them, so rect/circle.body should work for both of them.
So then why wont this work, anyone know?