Phaser API Documentation

  Version: 
hitTestBody(body, position)

Description:

Scans the current body to determine if a part of it was clicked on. If a part is found the body is set as the constraint.bodyB property, as well as the body property of this class. The part is also set.

Parameters:

name type description
body MatterJS.BodyType

The Matter Body to check.

position Phaser.Math.Vector2

A translated hit test position.

Returns:
Description:

true if a part of the body was hit, otherwise false.

Type:
  • boolean
Since: 3.16.2