Creating 'sticky' objects

I was just wondering if it was possible to create an object that other objects will 'stick' to if they come into contact with it? If so, how would I go about this? I expect that the most difficult thing to do will to be avoid gravity spoiling things...

Essentially what I want to have is a rotating shape in the centre of the screen (possibly a triangle), and if a ball ('fired' by the player) comes into contact with it I want the ball to stick to the side of the shape, and rotate with it until the player moves the ball again. Is this possible?

Any help is appreciated here, I'm a Box2d newbie 🙂
You could create a joint when the contact is first made, and then remove it when the ball should detach.
Ah yes I can see how that would work, how do I tell when contact is first made though? I seem to remember reading that this was tricky in Box2D...
this tutorial was for the 2.0.1 release, and im not sure what the changes are, but it might get you started on getting to know contact listeners

the tutorial is from Todd's Box2d tutorials and its this one!
Great, thank you very much!

I've actually been working my way through those tutorials (which are fantastic) already but haven't gotten that far 🙂 Silly me!

Original thread: https://box2d.org/forum/viewtopic.php?t=4744