Difference between revisions of "Fixture:setMask"

m
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{newin|[[0.8.0]]|080|type=method}}
 
{{newin|[[0.8.0]]|080|type=method}}
Sets the category mask of the fixture. There can be up to 16 categories represented as a number from 1 to 16.
+
 
 +
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.
 
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 ==
 
== Function ==
Line 12: Line 15:
 
{{param|number|mask1|The first category.}}
 
{{param|number|mask1|The first category.}}
 
{{param|number|mask2|The second category.}}
 
{{param|number|mask2|The second category.}}
 +
{{param|number|...|Additional categories.}}
 
=== 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]]
 
* [[Fixture:getMask]]
 
* [[Fixture:getMask]]
 +
* [[Fixture:setCategory]]
 +
* [[Fixture:getCategory]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Sets the category mask of the fixture.}}
+
{{#set:Description=Sets which categories this fixture should '''NOT''' collide with.}}
 
{{#set:Since=080}}
 
{{#set:Since=080}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|Fixture:setMask}}
 
{{i18n|Fixture:setMask}}

Latest revision as of 22:52, 1 December 2023

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


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