World:isCollisionEnabledBetween

Edit

Returns whether collisions are enabled between a pair of tags.

enabled = World:isCollisionEnabledBetween(tag1, tag2)

Arguments

NameTypeDescription
tag1string The first tag.
tag2string The second tag.

Returns

NameTypeDescription
enabledboolean Whether or not two colliders with the specified tags will collide.

Notes

If either tag is nil, this function returns true, for convenience. For example, the following function will still work if either of the colliders don't have a tag:

function willCollide(c1, c2)
  return world:isCollisionEnabledBetween(c1:getTag(), c2:getTag())
end

By default, collision is enabled between all tags.

Tags can be marked as "static" when the world is created, as an optimization hint. Static tags will never collide with other static tags, regardless of whether collision is enabled between them.

See also