Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8715 in orxonox.OLD for branches/terrain/src/lib/collision_detection


Ignore:
Timestamp:
Jun 22, 2006, 1:51:50 PM (19 years ago)
Author:
ponder
Message:
  • Added special checks for macosx to acinclude.m4 and configure.ac. This sucks
  • Reapplied the endianness checks to the md2_model file. They got lost during the merge operation.
  • Tried to do the collision detection for the ground. But somehow it doesn't work. Perhaps an offset will do.
File:
1 edited

Legend:

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

    r8490 r8715  
    2424#include "model.h"
    2525#include "world_entity.h"
    26 #include "terrain.h"
     26#include "terrain_entity.h"
    2727// #include "player.h"
    2828
     
    104104  std::list<WorldEntity*>::iterator entityIterator;
    105105  const std::list<BaseObject*>* bspList = ClassList::getList(CL_BSP_ENTITY);
    106   if( bspList == NULL)
    107     return;
     106  if( bspList != NULL) {
    108107
    109   // for all bsp managers check all entities
    110   for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
    111       for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
    112       {
    113 //         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
    114         (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
     108        // for all bsp managers check all entities
     109        for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
     110        for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
     111        {
     112//               PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
     113                (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
     114        }
     115        }
     116        }
     117        const std::list<BaseObject*>* tl = ClassList::getList( CL_TERRAIN );
     118  std::list<BaseObject*>::const_iterator ti;   
     119        if ( tl == NULL )
     120                return;
     121        for ( ti = tl->begin(); ti != tl->end(); ++ti ) {
     122                        TerrainEntity* terrain = dynamic_cast<TerrainEntity*>( *ti );
     123      for( entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++ )
     124                {
     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 );
     131                                }
    115132      }
    116   }
     133        }
    117134}
    118135
Note: See TracChangeset for help on using the changeset viewer.