class nape.dynamics.InteractionFilter

Available on all platforms

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!!
 *     }
 * }
 * 

Instance Fields

var collisionGroup:Int

Group bitfield for Collision type interactions. * @default 1

var collisionMask:Int

Mask bitfield for Collision type interactions. * @default -1 (all bits set)

var fluidGroup:Int

Group bitfield for Fluid type interactions. * @default 1

var fluidMask:Int

Mask bitfield for Fluid type interactions. * @default -1 (all bits set)

var sensorGroup:Int

Group bitfield for Sensor type interactions. * @default 1

var sensorMask:Int

Mask bitfield for Sensor type interactions. * @default -1 (all bits set)

var shapes: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.

var userData:DynamicDynamic

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. * * @default {}

function new(?collisionGroup:Int = 1, ?collisionMask:Int = -1, ?sensorGroup:Int = 1, ?sensorMask:Int = -1, ?fluidGroup:Int = 1, ?fluidMask:Int = -1):Void

Construct a new InteractionFilter. * *

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.

function copy():InteractionFilter

Produce a copy of this InteractionFilter * *

returns

The copy of this filter.

function 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. * *

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. *

function 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. * *

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. *

function 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. * *

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. *

function toString():String

@private