Sticking objects to other objects?

Basically I have a ball connected to two hooks by two separate ropes. These hooks can grab on to objects, this is done by basically saying "if the hook hits an object then stop moving". This works fine for static objects but if it grabs onto moving objects such as cogs then it obviously doesn't move with them. I've tried to solve this by setting the collision object (in this case the cog) to be the parent of the hooks. This works fine because the hooks then move with the object but occasionally an error will happen which breaks the whole game. For a split second the rope connecting the objects goes crazy, I believe it's because the hook is in the process of changing parents. Anyway. Does anyone have any idea how I could do this "sticking"?

Physics joints should be better and more stable. Not sure which one to use though, I guess you can start with FixedJoint to see if it works for you.