polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

terrain-collision.txt (702B)


      1 
      2 Basic Idea
      3 ==========
      4 
      5 Use an overlay grid for space partitioning vertex indices:
      6 
      7       0     1     2     3     4     5
      8     0 +-----+-----+-----+-----+-----+
      9       |     |     |     |     |     |
     10     1 +-----+-----+-----+-----+-----+
     11       |     |     | *   |     |     |
     12     2 +-----+-----+-----+-----+-----+
     13       |     |     |   * | * * |     |
     14     3 +-----+-----+-----+-----+-----+
     15       |     |  a  |  *  |  *  |     |
     16     4 +-----+-----+-----+-----+-----+
     17       |     |     |     |     |     |
     18     5 +-----+-----+-----+-----+-----+
     19 
     20   buckets = size / pdist ?
     21 
     22 
     23 Where *'s are indices to the corresponding vertex. We'll need to save
     24 height in memory so that collision can reference the heights.