I'm trying to make a simple magnet effect when my character is near a coin this should move to his position
I have this:
if(Mycharacter.position.x +2 >= position.x) //position = coin position
{
body.setTransform(Mycharacter.position.x, Mycharacter.position.y, 0);
}
This is close to what I want but I need to be able to see the movement of the coin to my character.
I'm still very new to Box2d and Libgdx so if possible keep it really simple guys, it doesn't help I'm terrible on physics. Thanks in advance.