I'm building a Rube Goldberg machine in Box2D and I need to have a "gear" catch a ball in its teeth. I have a circle shape and wish to draw 8 boxes at even intervals over the whole circle for the ball to fall into but I cannot figure out how to do this mathematically. Can someone help me out with the math? RW2PW(float) function just converts pixels from render world to meters in physics world. Below code is my circle. Thanks ahead for your help. I've been stressing over this for hours on end.
Code: Select all
b2CircleShape circle1;
circle1.m_radius = RW2PW(64.0f);
b2BodyDef bd1;
bd1.type = b2_dynamicBody;
bd1.position.Set(x, y);
b2Body* body1 = g_b2dPhysicsWorld.CreateBody(&bd1);
pGameObject1->SetPhysicsBody(body1);
body1->CreateFixture(&circle1, 5.0f);