Type Function Return value none Revision Release 2024.3703 Keywords physics, collision, filter, setupFilters See also collisionFilters.getFilter() collisionFilters.viewAllFilters()
Creates a collision filter association using convenient
This function returns nothing; it merely sets up the filters and alerts to any errors in configuration.
collisionFilters.setupFilters( filterTable )
Table. A table of
Each key in the table must be unique and it should represent a general category for the object(s) which will use it. For example, player
, enemies
, or powerUps
.
The key’s value can be either a single string or an array of strings. In either case, the specified string(s) should match other general categories which the key category will be masked against.
local collisionFilters = require( "plugin.collisionFilters" ) -- Set up collision filter relationship -- This example creates 4 collision categories ("player", "enemies", "powerUps", "playerBullets") collisionFilters.setupFilters( { player = { "enemies", "powerUps" }, -- Objects with "player" filter will collide with "enemies" + "powerUps" enemies = "playerBullets", -- Objects with "enemies" filter will collide with "playerBullets" })
Note that, even though only two