I’ve looked all over but cannot find a way to raycast while using the Matter.js part of Phaser. Is it even possible? If not, is there a good alternative?
Is there a way to detect if a matter body is in front of the player without the player having to run into it?
This will return an array of bodies hit by the ray, index 0 being the first body. It has to be matter bodies (I think), you find them in scene.matter.world.localWorld.bodies. This checks against all bodies, so might have to do some processing to get only the bodies you actually have to check against.