Page 1 of 1

Disable collisions on certain objects?

Posted: Tue Apr 20, 2010 7:04 pm
by blackops7799
Is there a way to disable collisions on certain objects while retaining collisions on others?

I'm currently working on a replica of the retro Atari Asteroids game.
http://i44.tinypic.com/t0nvwz.png

I need the asteroids to not collide with each other but allow the ship to collide with them? Is this even possible?
I've scanned the wiki for some info on disabling collisions and all I manged to find was something about making the object dynamic.

Think you could possibly add a new world callback that would act like so?

Code: Select all

function ShouldCollide( a, b, coll ) --return true or false to disable collisions 
	if a == "asteroid" and b == "asteroid" then
		return false
	else
		return true
	end
end
If there already is something like this could someone possibly point me in the right direction?
Thanks!

Re: Disable collisions on certain objects?

Posted: Tue Apr 20, 2010 7:07 pm
by bmelts
You should read about setting category masks in Box2D - http://love2d.org/wiki/Shape:setCategory and http://love2d.org/wiki/Shape:setMask

Re: Disable collisions on certain objects?

Posted: Tue Apr 20, 2010 7:08 pm
by blackops7799
Ahhh, thanks!
I'm just not exactly sure on how I would go about using it. :?

Nevermind, I figured it out. Thanks again!

Re: Disable collisions on certain objects?

Posted: Sun Apr 29, 2012 9:22 pm
by DmitryBochkarev
Really good game!