Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 21, 2006, 6:23:57 PM (18 years ago)
Author:
ponder
Message:

Tried to do the collision detection for the terrain.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/terrain/src/lib/collision_detection/cd_engine.cc

    r8328 r8684  
    101101  {
    102102        //kraus: TODO put collision detection for terrain class here...
     103        TerrainEntity *ground = dynamic_cast<TerrainEntity*>(this->terrain);
    103104    //Quadtree* q = dynamic_cast<TerrainEntity*>(this->terrain)->ssp->getQuadtree();
    104         //QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
     105        //QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
     106    std::list<WorldEntity*>::iterator iterator;
     107    PRINTF(3)("checking for collisions\n");
     108
     109    iterator = list1.begin();
     110    while ( iterator != list1.end() ) {
     111                const Vector& position = (*iterator)->getAbsCoor();
     112
     113                float height = ground->getHeight( position.x, position.z );
     114                PRINTF(2)( "height: %f\n", height );           
     115                if ( position.y < height )
     116                        (*iterator)->setAbsCoor( position.x, height, position.z );
     117    }   
    105118  }
    106119 
Note: See TracChangeset for help on using the changeset viewer.