Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 23, 2006, 11:29:40 AM (18 years ago)
Author:
ponder
Message:
  • Finally, I got the terrain working completly. What a hard work… It took me lots and lots of hours to remove all bugs in the tesselation routines.
File:
1 edited

Legend:

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

    r8715 r8741  
    119119        if ( tl == NULL )
    120120                return;
     121        float offset = 8.0f;
    121122        for ( ti = tl->begin(); ti != tl->end(); ++ti ) {
    122123                        TerrainEntity* terrain = dynamic_cast<TerrainEntity*>( *ti );
    123124      for( entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++ )
    124125                {
    125                                 const Vector& pos = (*entityIterator)->getAbsCoor();
    126                                
    127                                 float height = terrain->getHeight( pos.x, pos.z );
    128                                 printf( "pos.y-height: %f\n", pos.y-height );
    129                                 if ( height > pos.y ) {
    130                                         (*entityIterator)->setAbsCoor( pos.x, height, pos.z );
     126                                Vector pos( (*entityIterator)->getAbsCoor() );
     127                                Vector normal;
     128                                float height = pos.y;
     129                                terrain->getAltitude( pos, normal );
     130                                if ( height-offset < pos.y ) {
     131                                        ( *entityIterator )->registerCollision(
     132                                                *entityIterator, terrain, pos, normal );
    131133                                }
    132134      }
Note: See TracChangeset for help on using the changeset viewer.