Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Arcade
Phaser.Physics.Arcade

Classes

Namespace

Members

<static, readonly> DYNAMIC_BODY: number
Focus
Focus

Description:

Dynamic Body.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> FACING_DOWN: number
Focus
Focus

Description:

Facing down.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> FACING_LEFT: number
Focus
Focus

Description:

Facing left.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> FACING_NONE: number
Focus
Focus

Description:

Facing no direction (initial value).

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> FACING_RIGHT: number
Focus
Focus

Description:

Facing right.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> FACING_UP: number
Focus
Focus

Description:

Facing up.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> GROUP: number
Focus
Focus

Description:

Arcade Physics Group containing Dynamic Bodies.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> STATIC_BODY: number
Focus
Focus

Description:

Static Body.

Type:
number
Since: 3.0.0
Focus
Focus
<static, readonly> TILEMAPLAYER: number
Focus
Focus

Description:

A Tilemap Layer.

Type:
number
Since: 3.0.0
Focus
Focus

Methods

<static> GetOverlapX(body1, body2, overlapOnly, bias)
Focus
Focus

Description:

Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties accordingly, including: touching.left, touching.right, touching.none and `overlapX'.

Parameters:

name type description
body1 Phaser.Physics.Arcade.Body

The first Body to separate.

body2 Phaser.Physics.Arcade.Body

The second Body to separate.

overlapOnly boolean

Is this an overlap only check, or part of separation?

bias number

A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding).

Returns:
Description:

The amount of overlap.

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
<static> GetOverlapY(body1, body2, overlapOnly, bias)
Focus
Focus

Description:

Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties accordingly, including: touching.up, touching.down, touching.none and `overlapY'.

Parameters:

name type description
body1 Phaser.Physics.Arcade.Body

The first Body to separate.

body2 Phaser.Physics.Arcade.Body

The second Body to separate.

overlapOnly boolean

Is this an overlap only check, or part of separation?

bias number

A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding).

Returns:
Description:

The amount of overlap.

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
<static> SeparateX(body1, body2, overlapOnly, bias)
Focus
Focus

Description:

Separates two overlapping bodies on the X-axis (horizontally).

Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection.

The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation.

Parameters:

name type description
body1 Phaser.Physics.Arcade.Body

The first Body to separate.

body2 Phaser.Physics.Arcade.Body

The second Body to separate.

overlapOnly boolean

If true, the bodies will only have their overlap data set and no separation will take place.

bias number

A value to add to the delta value during overlap checking. Used to prevent sprite tunneling.

Returns:
Description:

true if the two bodies overlap vertically, otherwise false.

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
<static> SeparateY(body1, body2, overlapOnly, bias)
Focus
Focus

Description:

Separates two overlapping bodies on the Y-axis (vertically).

Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection.

The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation.

Parameters:

name type description
body1 Phaser.Physics.Arcade.Body

The first Body to separate.

body2 Phaser.Physics.Arcade.Body

The second Body to separate.

overlapOnly boolean

If true, the bodies will only have their overlap data set and no separation will take place.

bias number

A value to add to the delta value during overlap checking. Used to prevent sprite tunneling.

Returns:
Description:

true if the two bodies overlap vertically, otherwise false.

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus