Skip to main content
Version: Phaser v4.0.0

Phaser.Physics.Arcade.ProcessX

Scope: static

Source: src/physics/arcade/ProcessX.js#L418

Static functions

BlockCheck

<static> BlockCheck()

Description:

Checks whether either body is blocked in the direction of travel and, if so, applies the full impact velocity to the moving body and returns the blocked state. A body that is blocked cannot be separated further regardless of whether it is pushable.

Returns: number - The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked.

Source: src/physics/arcade/ProcessX.js#L71
Since: 3.50.0


Check

<static> Check()

Description:

Calculates the mass-adjusted impact velocities for both bodies, then determines which of the four horizontal collision scenarios applies (body1 or body2 moving left or right into the other) and delegates to Run with the corresponding side value.

Returns: boolean - true if a check passed, otherwise false.

Source: src/physics/arcade/ProcessX.js#L119
Since: 3.50.0


Run

<static> Run(side)

Description:

Executes the horizontal separation and velocity exchange for the two bodies based on the collision side determined by Check. Handles all combinations of pushable and non-pushable bodies: both pushable (equal mass-based rebound), only one pushable (full impact applied to the pushable body), or neither pushable (overlap split based on movement direction and relative velocity).

Parameters:

nametypeoptionaldescription
sidenumberNoThe side to test. As passed in by the Check function.

Returns: boolean - Always returns true.

Source: src/physics/arcade/ProcessX.js#L172
Since: 3.50.0


RunImmovableBody1

<static> RunImmovableBody1(blockedState)

Description:

Handles horizontal separation when Body1 is immovable and Body2 is not. Pushes Body2 out of the overlap and applies the full impact velocity to it. If Body1 is a moving platform (i.e. body1.moves is true), Body2's vertical position is also adjusted using Body1's vertical friction, allowing Body2 to ride along with the platform.

Parameters:

nametypeoptionaldescription
blockedStatenumberNoThe block state value.

Source: src/physics/arcade/ProcessX.js#L338
Since: 3.50.0


RunImmovableBody2

<static> RunImmovableBody2(blockedState)

Description:

Handles horizontal separation when Body2 is immovable and Body1 is not. Pushes Body1 out of the overlap and applies the full impact velocity to it. If Body2 is a moving platform (i.e. body2.moves is true), Body1's vertical position is also adjusted using Body2's vertical friction, allowing Body1 to ride along with the platform.

Parameters:

nametypeoptionaldescription
blockedStatenumberNoThe block state value.

Source: src/physics/arcade/ProcessX.js#L378
Since: 3.50.0


Set

<static> Set(b1, b2, ov)

Description:

Sets all of the local processing values and calculates the velocity exchanges.

Then runs BlockCheck and returns the value from it.

This method is called by Phaser.Physics.Arcade.SeparateX and should not be called directly.

Parameters:

nametypeoptionaldescription
b1Phaser.Physics.Arcade.BodyNoThe first Body to separate.
b2Phaser.Physics.Arcade.BodyNoThe second Body to separate.
ovnumberNoThe overlap value.

Returns: number - The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked.

Source: src/physics/arcade/ProcessX.js#L25
Since: 3.50.0