I'm developing a game using libGDX and box2d. I am facing a problem that bodies go through each other... I'm moving the body using a TouchPad by setTransform. I think the problem is that I use setTransform.
2 Answers
You have to use forces and impulses (physics) and the bodies will collide properly. I suggest you to do this like this:
body.applyForceToCenter(force.x*pad.getKnobPercentX(),force.y*pad.getKnobPercentY());
I can't add a comment, so I'm posting this as an answer. You should've provided some code. I had a similar issue, I was moving box2d bodies with .setTransform
. When using box2d, it's recommended that you move bodies applying forces. I don't know if that's your problem, so you might want to check how you're moving the bodies in your game. This can be due to several other problems, I can't tell without any code. I'm just sharing a similar issue that I had.