I'm trying to figure out how to add at runtime a shape to a body, keeping the distance from the two objects... I'll try to explain
I have the player floating on the screen, when it collides with an object, the player can pick up the object by pressing one button.
Right now I'm using this:
Code: Select all
int grabObject(cpShape *a, cpShape *b, cpContact *contacts, int numContacts, cpFloat normal_coef, void *data)
{
if(_objCaught == false && _beamOn)
{
b->body = a->body;
_objCaught = true;
}
return _objCaught;
}
Right now the object is picked up, but it translates right under the player's position, I want it to stay at the relative distance from the player that it is when the player picks it up... so, in other words, I want the object to stay attached to the winch, not under the player.
Any ideas?
Thanks