Namespace: Components

Phaser.Physics.Arcade. Components

Namespaces

Acceleration
Angular
Bounce
Debug
Drag
Enable
Friction
Gravity
Immovable
Mass
Pushable
Size
Velocity

Methods


<static> OverlapCirc(x, y, radius [, includeDynamic] [, includeStatic])

This method will search the given circular area and return an array of all physics bodies that overlap with it. It can return either Dynamic, Static bodies or a mixture of both.

A body only has to intersect with the search area to be considered, it doesn't have to be fully contained within it.

If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast, otherwise the search is O(N) for Dynamic Bodies.

Parameters:
Name Type Argument Default Description
x number

The x coordinate of the center of the area to search within.

y number

The y coordinate of the center of the area to search within.

radius number

The radius of the area to search within.

includeDynamic boolean <optional>
true

Should the search include Dynamic Bodies?

includeStatic boolean <optional>
false

Should the search include Static Bodies?

Since: 3.21.0
Source: src/physics/arcade/components/OverlapCirc.js (Line 6)
Returns:

An array of bodies that overlap with the given area.

Type
Array.<Phaser.Physics.Arcade.Body> | Array.<Phaser.Physics.Arcade.StaticBody>

<static> OverlapRect(x, y, width, height [, includeDynamic] [, includeStatic])

This method will search the given rectangular area and return an array of all physics bodies that overlap with it. It can return either Dynamic, Static bodies or a mixture of both.

A body only has to intersect with the search area to be considered, it doesn't have to be fully contained within it.

If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast, otherwise the search is O(N) for Dynamic Bodies.

Parameters:
Name Type Argument Default Description
x number

The top-left x coordinate of the area to search within.

y number

The top-left y coordinate of the area to search within.

width number

The width of the area to search within.

height number

The height of the area to search within.

includeDynamic boolean <optional>
true

Should the search include Dynamic Bodies?

includeStatic boolean <optional>
false

Should the search include Static Bodies?

Since: 3.17.0
Source: src/physics/arcade/components/OverlapRect.js (Line 1)
Returns:

An array of bodies that overlap with the given area.

Type
Array.<Phaser.Physics.Arcade.Body> | Array.<Phaser.Physics.Arcade.StaticBody>