[love.physics] reject collision from callback

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
devyn
Prole
Posts: 12
Joined: Tue Dec 29, 2009 5:56 am

[love.physics] reject collision from callback

Post 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!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [love.physics] reject collision from callback

Post by Robin »

You can dynamically use shape:setCategory() and shape:setMask(). That's what LovelyBigPlanet uses.
Help us help you: attach a .love.
User avatar
devyn
Prole
Posts: 12
Joined: Tue Dec 29, 2009 5:56 am

Re: [love.physics] reject collision from callback

Post by devyn »

Oh, really? Okay, never mind then! :P I just assumed from reading the Box2d docs, but whatever, yay!
User avatar
devyn
Prole
Posts: 12
Joined: Tue Dec 29, 2009 5:56 am

Re: [love.physics] reject collision from callback

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 76 guests