Page 1 of 1

[love.physics] reject collision from callback

Posted: Fri Jan 01, 2010 12:46 pm
by devyn
So basically, I want to be able to reject/allow collision handling dynamically. I already have callbacks and collision selection set up, I just want to know if there is a way to disallow love.physics from handling the collision itself—I want sort of a collision access control list.

Thought of layers, etc. but they only work when you're making the definitions for the shapes, you can't dynamically change a shape's mask (sadly)

Please help!

Re: [love.physics] reject collision from callback

Posted: Fri Jan 01, 2010 1:33 pm
by Robin
You can dynamically use shape:setCategory() and shape:setMask(). That's what LovelyBigPlanet uses.

Re: [love.physics] reject collision from callback

Posted: Fri Jan 01, 2010 2:14 pm
by devyn
Oh, really? Okay, never mind then! :P I just assumed from reading the Box2d docs, but whatever, yay!

Re: [love.physics] reject collision from callback

Posted: Fri Jan 01, 2010 2:58 pm
by devyn
Okay, yes, that works—I was using it wrong before :oops:

Is there any way to make a certain shape act like a sensor to one category, and normally in another? I want to detect whether a certain collision has happened with a shape tagged using Shape:setData, and if so, change the mask.

Edit: I may have just answered my own question—create two shapes on the same body.