Phaser Raycaster is a Phaser 3 plugin, released by Wiserim, which provides raycasting for geometric Game Objects, Sprites, Arcade Physics, and Matter Physics bodies.

It has been in development for a while, but the new v0.10.11 release has just been made available, with updated documentation and examples to be found on CodePen.

Features

  • compatible with arcade and matter physics,
  • raycasting in a single direction, 360 degrees circle or in a cone,
  • visibility detection (collision detection with game objects),
  • test rays on mapped game objects (containers, lines, rectangles, polygons, circles, sprites, tilemaps and matter bodies),
  • provides closest intersection points between rays and tested objects,
  • tests can be made on all mapped objects, selected ones or only ones within detection range,
  • static and dynamic mapping for individual objects,
  • mapped objects intersections detection,
  • debug mode.

View on GitHub