A while back I posted several examples on 2D raycasting using Phaser 3’s various built-in geometry methods. I built a simple raycaster class which detected collisions against Geom.polygons. Fundamentally it was based on the Phaser’s Geom.Intersects.GetLineToPolygon method. I recently found out that this method returns null if the “line” is vertical. If you are casting lots of rays at the same time this is barely noticeable but it does become a problem if you are casting a ray downwards to detect collision against ground, for example. So I wrote a revised version of the raycaster class. That in itself would be boring so I wrote a quick demo that uses raycast to allow Mr Dude to climb up and down slopes made of polygons.
As usual I have jotted down the key learnings in my blog here.