Real-time sprite-collision 2D raycasting (3D maze)

944
0
Published 2020-02-23
A sprite-collision based raycasting (moving the rays around in small steps until it finds intersection with sprites collision detection)
We had applied several tricks to achieve an efficient method to calculate the distance of each ray. One pixel width of the line segment for collision detection is passive, and just let the maps move to collide with them for each of ray.

I reckon the sprite-touch compares every single pixel, therefore it tends to be slower for broader areas.
According to scratch.mit.edu/projects/110878444/ the sprite became larger, when it's rotated away from a multiple of 90 degrees. So, it's must be avoided when being used as collision detection for raycasting.