Detector
class Detector
the Detector class contains methods for detecting collisions between bodies using a broadphase algorithm.
Constructor
Summary
Properties from Detector
Methods from Detector
boolean |
|
boolean |
|
Public Properties
response: ResponseObject
ResponseObject
the default response object used for collisions (will be automatically populated by the collides functions)
Public Methods
collides(bodyA: Body, bodyB: Body) → {boolean}
detect collision between two bodies.
Name | Type | Description |
---|---|---|
bodyA | Body |
a reference to body A. |
bodyB | Body |
a reference to body B. |
Type | Description |
---|---|
boolean |
true if colliding |
shouldCollide(a: Renderable | Container | Entity | Sprite | NineSliceSprite, b: Renderable | Container | Entity | Sprite | NineSliceSprite) → {boolean}
determine if two objects should collide (based on both respective objects body collision mask and type).
you can redefine this function if you need any specific rules over what should collide with what.
Name | Type | Description |
---|---|---|
a | Renderable | Container | Entity | Sprite | NineSliceSprite |
a reference to the object A. |
b | Renderable | Container | Entity | Sprite | NineSliceSprite |
a reference to the object B. |
Type | Description |
---|---|
boolean |
true if they should collide, false otherwise |