Simulate grabbing of an object

Hey guys,

Does anyone have a suggestion on how to implement the "grabbing" of an object by your main character. I would like my hero to be able to grab an object and either push or pull it.

What steps should i take when i've detected collision between the two objects? I'd like to pop up a new button on the hud layer that the user can press to grab the object as well, but i don't want the hero to actually run into the object as this object could be fatal to him (if you played Limbo for XBLA, think the bear traps). So i guess i have two main questions.

1) How can I detected a collision that is about to happen
2) How can i then use the hero to "grab" (push/pull) the object

I've toyed around with Joints, but i'm not sure that will work as I only need the grab object to slide. I've also used the SetTransform method on the object but I get adverse affects (the object will not collide with walls, etc)

And suggestions would be greatly appreciated.
You might want to try to add a sensor around the object:
Attachment:
sensor.png
sensor.png [ 1.52 KiB | Viewed 72 times ]


I'm quoting the manual:
Quote:
6.3 Sensors
Sometimes game logic needs to know when two fixtures overlap yet there should be no collision response. This is done by using sensors. A sensor is a fixture that detects collision but does not produce a response.

Sensors don't collide, but raise contact events that you can catch with a custom contact listener.
See http://www.box2d.org/manual.html#_Toc258082972

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