Class b2ContactFilter

Implement this class to provide collision filtering. In other words, you can implement this class if you want finer control over contact creation.

Index

Methods

Methods

public RayCollide(userData: any): boolean

Return true if the given fixture should be considered for ray intersection. By default, userData is cast as a b2Fixture and collision is resolved according to ShouldCollide.

note

This function is not in the box2dweb.as code -- might not work.

see

b2World.Raycast()

see

b2ContactFilter.ShouldCollide()

Parameters

  • userData: any

    User provided data. Comments indicate that this might be a b2Fixture.

Returns

boolean

True if the fixture should be considered for ray intersection, otherwise false.

public ShouldCollide(fixtureA: b2Fixture, fixtureB: b2Fixture): boolean

Return true if contact calculations should be performed between these two fixtures.

warning

For performance reasons this is only called when the AABBs begin to overlap.

Parameters

  • fixtureA: b2Fixture

    b2Fixture potentially colliding with fixtureB.

  • fixtureB: b2Fixture

    b2Fixture potentially colliding with fixtureA.

Returns

boolean

True if fixtureA and fixtureB probably collide requiring more calculations, otherwise false.