Difference between revisions of "Fixture:setFilterData"

m
(Point to its individual component functions)
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
Groups, categories, and mask can be used to define the collision behaviour of the fixture.
 
Groups, categories, and mask can be used to define the collision behaviour of the fixture.
  
If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. Is the group zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each others categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
+
If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. If the group is zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each other's categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
  
 
There can be up to 16 categories. Categories and masks are encoded as the bits of a 16-bit integer.
 
There can be up to 16 categories. Categories and masks are encoded as the bits of a 16-bit integer.
 +
 +
When created, prior to calling this function, all fixtures have category set to 1, mask set to 65535 (all categories) and group set to 0.
 +
 +
This function allows setting all filter data for a fixture at once. To set only the categories, the mask or the group, you can use [[Fixture:setCategory]], [[Fixture:setMask]] or [[Fixture:setGroupIndex]] respectively.
  
 
== Function ==
 
== Function ==

Latest revision as of 11:51, 24 June 2018

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

Sets the filter data of the fixture.

Groups, categories, and mask can be used to define the collision behaviour of the fixture.

If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. If the group is zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each other's categories selected, the return value of the custom contact filter will be used. They always collide if none was set.

There can be up to 16 categories. Categories and masks are encoded as the bits of a 16-bit integer.

When created, prior to calling this function, all fixtures have category set to 1, mask set to 65535 (all categories) and group set to 0.

This function allows setting all filter data for a fixture at once. To set only the categories, the mask or the group, you can use Fixture:setCategory, Fixture:setMask or Fixture:setGroupIndex respectively.

Function

Synopsis

Fixture:setFilterData( categories, mask, group )

Arguments

number categories
The categories as an integer from 0 to 65535.
number mask
The mask as an integer from 0 to 65535.
number group
The group as an integer from -32768 to 32767.

Returns

Nothing.

See Also


Other Languages