0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ You need to give us more details than that, as it stands the question is impossible to answer. \$\endgroup\$ – bornander Feb 21 '16 at 8:35
-1
\$\begingroup\$

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());
\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.