hitTest(worldPoint, bodies, precision, filterStatic) → {Array}
Test if a world point overlaps bodies. You will get an array of actual P2 bodies back. You can find out which Sprite a Body belongs to
(if any) by checking the Body.parent.sprite property. Body.parent is a Phaser.Physics.P2.Body property.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
worldPoint | Phaser.Point | Point to use for intersection tests. The points values must be in world (pixel) coordinates. | ||
bodies | Array.<(Phaser.Physics.P2.Body | Phaser.Sprite | p2.Body)> | <optional> | A list of objects to check for intersection. If not given it will check Phaser.Physics.P2.world.bodies (i.e. all world bodies) | |
precision | number | <optional> | 5 | Used for matching against particles and lines. Adds some margin to these infinitesimal objects. |
filterStatic | boolean | <optional> | false | If true all Static objects will be removed from the results array. |
Returns
Array of bodies that overlap the point.
- Source code: physics/p2/World.js (Line 1357)
Please login to continue.