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\$
1
  • \$\begingroup\$ You need to give us more details than that, as it stands the question is impossible to answer. \$\endgroup\$ Commented Feb 21, 2016 at 8:35

2 Answers 2

-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\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.