Changeset 9101 in orxonox.OLD for branches/presentation
- Timestamp:
- Jul 4, 2006, 4:38:53 AM (19 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 2 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); -
branches/presentation/src/world_entities/creatures/fps_player.cc
r9085 r9101 27 27 #include "weapons/cannon.h" 28 28 #include "weapons/fps_sniper_rifle.h" 29 30 #include "aabb.h" 29 31 30 32 #include "key_mapper.h" … … 124 126 125 127 this->getWeaponManager().setSlotCount(2); 126 this->getWeaponManager().setSlotPosition(0, Vector(1.5, -0.7, 1.1));127 128 // this->getWeaponManager().setSlotDirection(0, Quaternion(M_PI_2, Vector(0,1,0))); 128 129 this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 129 this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0));130 130 this->getWeaponManager().setSlotDirection(1, Quaternion(M_PI_4*.5, Vector(1,0,0))); 131 132 133 AABB* box = this->getModelAABB(); 134 if( box != NULL) 135 { 136 this->getWeaponManager().setSlotPosition(0, Vector(1.5, box->halfLength[1] * 2.0f - 0.7, 1.1)); 137 this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * 2.0f, 0.0)); 138 } 139 else 140 { 141 this->getWeaponManager().setSlotPosition(0, Vector(1.5, -0.7, 1.1)); 142 this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0)); 143 } 144 131 145 132 146 this->getWeaponManager().setParentNode(&this->cameraNode); … … 191 205 192 206 193 State::getCameraNode()->setRelCoor(0,0,0); 194 State::getCameraTargetNode()->setRelCoor(10,0,0); 207 AABB* box = this->getModelAABB(); 208 if( box != NULL) 209 { 210 State::getCameraNode()->setRelCoor(0, box->halfLength[1] * 2.0f, 0); 211 State::getCameraTargetNode()->setRelCoor(10, box->halfLength[1] * 2.0f, 0); 212 } 195 213 } 196 214 … … 209 227 void FPSPlayer::tick (float time) 210 228 { 211 229 212 230 if( this->bPosBut) 213 231 { … … 215 233 printf("mechanic:walkTo( %f, mheight, %f)\n",this->getAbsCoorX(),this->getAbsCoorZ()); 216 234 } 217 235 218 236 Playable::tick( time ); 219 237
Note: See TracChangeset
for help on using the changeset viewer.