Changeset 8715 in orxonox.OLD for branches/terrain/src/lib/collision_detection
- Timestamp:
- Jun 22, 2006, 1:51:50 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/terrain/src/lib/collision_detection/cd_engine.cc
r8490 r8715 24 24 #include "model.h" 25 25 #include "world_entity.h" 26 #include "terrain .h"26 #include "terrain_entity.h" 27 27 // #include "player.h" 28 28 … … 104 104 std::list<WorldEntity*>::iterator entityIterator; 105 105 const std::list<BaseObject*>* bspList = ClassList::getList(CL_BSP_ENTITY); 106 if( bspList == NULL) 107 return; 106 if( bspList != NULL) { 108 107 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 } 115 132 } 116 133 } 117 134 } 118 135
Note: See TracChangeset
for help on using the changeset viewer.