InteractionFilter provides bit flags for low-level filtering of interactions.

For a given interaction type, two Shapes will be permitted to interact only if (shape1.group & shape2.mask) != 0 && (shape2.group & shape1.mask) != 0

There are 32 real groups corresponding to a set bit in the group/mask fields. For instance a group value of 0x120 corresponds to the 'real' groups 5 and 8 as 0x120 = (1<<5) | (1<<8)

Nape provides group/mask for each interaction type. The actual precedence of interactions is further defined simply as: Sensor > Fluid > Collision.
Two static bodies can never interact, and with the exception of sensor interaction, at least one of the two bodies must be dynamic.
Sensor interactions have the highest precedence, followed by fluid and then collisions. Sensor interaction is permitted only if one of the shapes is sensorEnabled, whilst fluid is permitted only if one of the shapes is fluidEnabled.

if ((shapeA.sensorEnabled || shapeB.sensorEnabled) && shapeA.filter.shouldSense(shapeB.filter)) {

SENSOR INTERACTION!!

} else if (bodyA.isDynamic() || bodyB.isDynamic()) {

if ((shapeA.fluidEnabled || shapeB.fluidEnabled) && shapeA.filter.shouldFlow(shapeB.filter)) {
    FLUID INTERACTION!!
}
else if (shapeA.filter.shouldCollide(shapeB.filter)) {
    COLLISION INTERACTION!!
}

}

Constructor

@:value({ fluidMask : -1, fluidGroup : 1, sensorMask : -1, sensorGroup : 1, collisionMask : -1, collisionGroup : 1 })new(collisionGroup:Int = 1, collisionMask:Int = -1, sensorGroup:Int = 1, sensorMask:Int = -1, fluidGroup:Int = 1, fluidMask:Int = -1)

Construct a new InteractionFilter.

Parameters:

collisionGroup

The Group bitfield for Collision interactions. (default 1)

collisionMask

The Mask bitfield for Collision interactions. (default -1)

sensorGroup

The Group bitfield for Sensor interactions. (default 1)

sensorMask

The Mask bitfield for Sensor interactions. (default -1)

fluidGroup

The Group bitfield for Fluid interactions. (default 1)

fluidMask

The Mask bitfield for Fluid interactions. (default -1)

Returns:

The newly constructed InteractionFilter.

Variables

collisionGroup:Int

Group bitfield for Collision type interactions.

collisionMask:Int

Mask bitfield for Collision type interactions.

fluidGroup:Int

Group bitfield for Fluid type interactions.

fluidMask:Int

Mask bitfield for Fluid type interactions.

sensorGroup:Int

Group bitfield for Sensor type interactions.

sensorMask:Int

Mask bitfield for Sensor type interactions.

read onlyshapes:ShapeList

Set of all active shapes using this object.

Activeness of a shape in the sense that the Shape's Body is inside of a Space.

This list is immutable.

read onlyuserData:Dynamic<Dynamic>

Dynamic object for user to store additional data.

This object cannot be set, only its dynamically created properties may be set. In AS3 the type of this property is &#42

This object will be lazily constructed so that until accessed for the first time, will be null internally.

@:value(null)zpp_inner:ZPP_InteractionFilter = null

@private

Methods

copy():InteractionFilter

Produce a copy of this InteractionFilter

Returns:

The copy of this filter.

shouldCollide(filter:InteractionFilter):Bool

Determine if objects are permitted to collide based on InteractionFilters

A collision type interaction can occur only if this returns True.

Parameters:

filter

The filter to evaluate possibility of collision with.

Returns:

True, if based on interaction filters only the two objects would be able to collide.

Throws:

#

If filter is null.

shouldFlow(filter:InteractionFilter):Bool

Determine if objects are permitted to interact as fluids based on InteractionFilters

A fluid type interaction can occur only if this returns True.

Parameters:

filter

The filter to evaluate possibility of fluid with.

Returns:

True, if based on interaction filters only the two objects would be able to interact as fluids.

Throws:

#

If filter is null.

shouldSense(filter:InteractionFilter):Bool

Determine if objects are permitted to sense based on InteractionFilters

A sensor type interaction can occur only if this returns True.

Parameters:

filter

The filter to evaluate possibility of sensor with.

Returns:

True, if based on interaction filters only the two objects would be able to sense.

Throws:

#

If filter is null.

toString():String

@private