Changeset 9101 in orxonox.OLD for branches/presentation/src/lib
- Timestamp:
- Jul 4, 2006, 4:38:53 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9100 r9101 94 94 switch( ce->getType()) 95 95 { 96 /* collision in the X-AXIS */96 /* collision in the X-AXIS */ 97 97 case COLLISION_TYPE_AXIS_X: 98 98 front = collPos.len() - box->halfLength[0]; … … 101 101 if( front <= 0.0f ) 102 102 { 103 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); 103 Vector dirX = entity->getAbsDirX(); 104 dirX.y = 0.0f; 105 dirX.normalize(); 104 106 Vector backoff = dirX * front; 105 107 106 //entity->setAbsCoor(entity->getLastAbsCoor()); 107 entity->shiftCoor(backoff); 108 } 109 // object is already in the wall 110 else if( ce->isInWall()) 111 { 112 entity->setAbsCoor(entity->getLastAbsCoor()); 108 entity->shiftCoor(backoff); 109 } 110 else if( ce->isInWall()) 111 { 112 // object is already in the wall 113 entity->setAbsCoor(entity->getLastAbsCoor()); 113 114 } 114 115 break; … … 122 123 if( back <= 0.0f) 123 124 { 124 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); 125 Vector dirX = entity->getAbsDirX(); 126 dirX.y = 0.0f; 127 dirX.normalize(); 125 128 Vector backoff = dirX * back * -1.0f; 126 129 127 //entity->setAbsCoor(entity->getLastAbsCoor()); 128 entity->shiftCoor(backoff); 129 } 130 // object is already in the wall 131 else if( ce->isInWall()) 132 { 133 entity->setAbsCoor(entity->getLastAbsCoor()); 130 entity->shiftCoor(backoff); 131 } 132 else if( ce->isInWall()) 133 { 134 // object is already in the wall 135 entity->setAbsCoor(entity->getLastAbsCoor()); 134 136 } 135 137 break; … … 143 145 144 146 // object is beneath the plane (ground) 145 // if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing147 // if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing 146 148 if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT) 147 149 { … … 163 165 164 166 167 /* collision in the Z-AXIS */ 168 case COLLISION_TYPE_AXIS_Z: 169 170 right = collPos.len() - box->halfLength[2]; 171 172 // object is beneath the plane (ground) 173 if( right <= 0.0f ) 174 { 175 Vector dirZ = entity->getAbsDirZ(); 176 dirZ.y = 0.0f; 177 dirZ.normalize(); 178 Vector backoff = dirZ * right; 179 entity->shiftCoor(backoff); 180 } 181 else if( ce->isInWall()) 182 { 183 // object is already in the wall 184 entity->setAbsCoor(entity->getLastAbsCoor()); 185 } 186 break; 187 188 165 189 // collision in the z-axis 166 case COLLISION_TYPE_AXIS_Z:167 168 right = collPos.len() - box->halfLength[2];169 170 // object is beneath the plane (ground)171 if( right <= 0.0f )172 {173 entity->setAbsCoor(entity->getAbsCoor());174 Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();175 Vector backoff = dirZ * right;176 entity->shiftCoor(backoff);177 }178 // object is already in the wall179 else if( ce->isInWall())180 {181 entity->setAbsCoor(entity->getLastAbsCoor());182 }183 break;184 185 186 // collision in the z-axis187 190 case COLLISION_TYPE_AXIS_Z_NEG: 188 191 … … 192 195 if( left <= 0.0f ) 193 196 { 194 Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize(); 197 Vector dirZ = entity->getAbsDirZ(); 198 dirZ.y = 0.0f; 199 dirZ.normalize(); 195 200 Vector backoff = dirZ * left*-1.0f; 196 201 entity->shiftCoor(backoff);
Note: See TracChangeset
for help on using the changeset viewer.