Physics question

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
serge1peshcoff
Prole
Posts: 6
Joined: Mon Sep 03, 2012 12:34 pm

Physics question

Post 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?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Physics question

Post 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.
When I write def I mean function.
serge1peshcoff
Prole
Posts: 6
Joined: Mon Sep 03, 2012 12:34 pm

Re: Physics question

Post by serge1peshcoff »

Yes, it it exactly what I want! Thanks a lot!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot] and 7 guests