Understanding anchor point in PhysicsJointFixed

I’m developing a little prototype game using the built in physics in v.3 and am having difficulty understanding how PhysicsFixedJoint should work.

I have a large circular body (‘wheel’) that is fixed in the world with a PhysicsJointPin at its centre and can freely rotate. I want to fix a smaller circular body (‘ball’) to be touching the outside of this body, so that they will become locked together.

This screenshot shows how this looks so far http://i1293.photobucket.com/albums/b589/stevebarnegren/Screen%20Shot%202015-06-08%20at%2012.52.08_zpsljbrijij.png

It sort of works, but as you can see the green dot representing the joint is in a funny position. Sometimes this joint will differ greatly from the position of the ball, causing the physics to go haywire.

I suspect that it is to do with the third argument when constructing the joint (anchor point):

cocos2d::PhysicsJointFixed *joint = cocos2d::PhysicsJointFixed::construct(ball->getPhysicsBody(),
                                                                              wheel->getPhysicsBody(),
                                                                              Vec2(wheelPos.x - jointXDist, wheelPos.y - jointYDist));

This places the anchor point at the point where the ball and wheel touch, is that correct? I have double checked the maths by placing drawNodes at that point, but the joint debug dot never shows up at the same position.

Any help would be greatly appreciated!

Hi, did you ever fix this? I’m having similar problems; can’t get PhysicsJointFixed to work properly at all. The joint always appears at a crazy position.

No, I never got it working!

I can’t offer you any alternative I’m afraid, because I abandoned the project shortly after this, so I never found a solution.

I tried a bunch of things, but I could get the joints to consistently work. It put me off using the built in physics a bit tbh, although it might just have been my misunderstanding of how they should behave.

Ah shame - thanks for replying though! I already have the integrated physics quite heavily used in my game, only using spring joints though which appear to be fine… Gonna have a look at the test projects and see if I can work this out.