screen_36

For our Global Game Jam entry Spider vs Dragon, we wanted to use a funky grid. We settled on the inside of a torus, and to make things a bit more interesting, we distorted the torus by adjusting the small radius by a sine wave.

The basic idea is to implement a custom map that maps rect points to the torus, using the pretty straightforward equations on Wikipedia. We also augmented the map with extra methods that give the appropriate up vectors, and the central circle. To generate the grid, we put a plane at each grid point using positions obtained from the map, and orient the plane using a look-at vector (constructed from the central circle point and current point) and the up vector. (This is of course not very efficient – in ‘n non-prototype you will generate a mesh instead. The same information will be used, though).

The camera, as it races through the grid, uses the same calculations to position and orient itself.

normal_torus2

Grid with no distortion.

deformed_torus

Torus with extensive distortion.

Map

Main