0
votes

I will have 2 teams in my game, every team has X balls, I want to detect when they collide, not to apply force or impulse but to apply "Damage" to the affected balls.

I've read about contactListener but then you have to check wether it is from team A or B or same team and so on.. the thing is I want to use filters as I've read somewhere, but I can't decide what happens when they collide, it's like they will react depending on their density, friction and so on, but I want to detect collision and apply what I want instead.

I'm using libgdx with box2d

1

1 Answers

0
votes

I recommand to read this : http://www.iforce2d.net/b2dtut/collision-anatomy It is a well documented box2D tutoriels based on C++ implementation but you will found all methods and class in libGDX.

For what you want to do, you just have to disable contact (contact.setEnabled(false)) in presolve method in your listener. That's tell box2D to not apply any force for this collision.