2D Spacial Tile and Raycast Demo
How to use this demo: Drag the circles around the grid, the Raycast engine will draw the grid spaces the line currently occupies. Spacial grids are often used in game environments for a multitude of reasons. For example, in a tile based game such as an electronic board game, the spacial grid could be used to determine each players board piece location. The raycast algorithm works by first validating that the ray passes through the grid. If so, it locates the starting point within the grid and calculates each cell of the grid based on differences between distances of each axis. It then steps through each cell until it reaches its own end point or leaves the grid space. This theory can be used to potentially cut down the number of collision checks a program has to check for at any given time. By modelling a players velocity as a ray, one can make an educated guess as to which shapes are likely to intersect by checking the spacial grid for any "occupied" tiles.
Flash designer with 4+ experience in AS2/3, programmatic design and IDE animation. Currently developing 2D game engine related classes and libraries, animation utilities and user interaction components.