Page 1 of 1

Physics question

Posted: Wed Oct 24, 2012 4:36 pm
by serge1peshcoff
I need to create a body, which reacting with another body. I need this body to behave like it is background (another bodies should pass through this body), but I also need body to trigger callback functions. Can I do this?

Re: Physics question

Posted: Wed Oct 24, 2012 5:44 pm
by kikito
Yes. Simplest way is using Fixture:setSensor(true). The "background object" won't collide with anything, but it will throw callbacks.

A more complex way to do it would be with Fixture:setFilterData. With that function you can make the background body collide with some objects but not with others, make groups, etc.

Re: Physics question

Posted: Sat Oct 27, 2012 7:23 am
by serge1peshcoff
Yes, it it exactly what I want! Thanks a lot!