Difference between revisions of "Fixture:setMask"

m (Added missing "..." in arguments, added Fixture:set/getMask in see also)
Line 20: Line 20:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
 +
== Examples ==
 +
<source lang="lua">
 +
Body.fixture:setCategory(1)
 +
Body.fixture:setMask(1)              -- this fixture is in category 1 and will not physically collide with other fixtures in category 1
 +
</source>
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::Fixture]]
 
* [[parent::Fixture]]

Revision as of 01:48, 28 April 2023

Available since LÖVE 0.8.0
This method is not supported in earlier versions.


O.png Fixture:setMask works in NOT Categories selected will NOT collide with this fixture. If you want to work as Box2d works with Mask use instead Fixture:setFilterData  


Sets the category masks of the fixture. There can be up to 16 categories represented as a number from 1 to 16.

This fixture will NOT collide with the fixtures that are in the selected categories if the other fixture also has a category of this fixture selected.

Calling this function with no arguments will make the fixture have no masks.

Function

Synopsis

Fixture:setMask( mask1, mask2, ... )

Arguments

number mask1
The first category.
number mask2
The second category.
number ...
Additional categories.

Returns

Nothing.

Examples

Body.fixture:setCategory(1)
Body.fixture:setMask(1)               -- this fixture is in category 1 and will not physically collide with other fixtures in category 1

See Also


Other Languages