0
\$\begingroup\$

I have two bodies with fixtures. One is platform or ground and other is the player itself.I want to collide the player to the platform without bit filtering.How can i do that?I can see the rectangular ghost layer(like a rectangular box) and the box2d falling through it.I want the box2d to collide.

create player

\$\endgroup\$
  • \$\begingroup\$ Can you clarify why "without filtering" is a requirement of your case? Generally filtering helps performance by limiting the objects that can collide to just the objects we want to collide. It shouldn't prevent you from getting collisions between player and platform objects if you've configured your filters correctly. Do you need help configuring the filters' category & mask bits to ensure the player & platform can collide? \$\endgroup\$ – DMGregory Aug 6 '18 at 11:57
  • \$\begingroup\$ My teacher wants me to implement a different logic for collision detection which is the overlap method.I already have the code for bit filtering method but not for the overlap method.Can you help me achieve collision between player and ground using overlap method? \$\endgroup\$ – satya Aug 6 '18 at 19:02
  • \$\begingroup\$ If that's what you want, then you should edit your question to say so, and define what you & your teacher mean by "the overlap method" to make sure we're all on the same page. \$\endgroup\$ – DMGregory Aug 6 '18 at 19:28
3
\$\begingroup\$

setfdef.isSensor = false;
and fixdef.isSensor = false;

A sensor shape collects contact information but never generates a collision response.

See FixtureDef documentation:
https://libgdx.badlogicgames.com/ci/nightlies/docs/api/com/badlogic/gdx/physics/box2d/FixtureDef.html#isSensor

You can use .isSensor = true; for an attack range of monster or a poisoned area

\$\endgroup\$
  • \$\begingroup\$ Thank you but I want the overlap method logic for collision detection between player and ground \$\endgroup\$ – satya Aug 6 '18 at 18:58

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.