Changeset 9235 in orxonox.OLD for trunk/src/lib/collision_reaction
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- Location:
- trunk/src/lib/collision_reaction
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_reaction/Makefile.am
r8490 r9235 10 10 collision_reaction.cc \ 11 11 cr_object_damage.cc \ 12 cr_physics_ground_walk.cc 12 cr_physics_ground_walk.cc \ 13 cr_physics_full_walk.cc 13 14 14 15 … … 21 22 collision_reaction.h \ 22 23 cr_object_damage.h \ 23 cr_physics_ground_walk.h 24 cr_physics_ground_walk.h \ 25 cr_physics_full_walk.h 24 26 -
trunk/src/lib/collision_reaction/collision_handle.cc
r8724 r9235 25 25 #include "cr_object_damage.h" 26 26 #include "cr_physics_ground_walk.h" 27 #include "cr_physics_full_walk.h" 27 28 28 29 #include "debug.h" … … 52 53 switch( type) 53 54 { 54 case CREngine::CR_PHYSICS_ STEP_BACK:55 // this->collisionReaction = new CRPhysicsGroundWalk();55 case CREngine::CR_PHYSICS_FULL_WALK: 56 this->collisionReaction = new CRPhysicsFullWalk(); 56 57 this->bContinuousPoll = true; 57 58 break; … … 229 230 for(; it < this->targetList.end(); it++) 230 231 { 232 // if(collisionEvent->getEntityB()->isA(CL_AIMING_SYSTEM) || collisionEvent->getEntityA()->isA(CL_AIMING_SYSTEM)) 233 // { 234 // PRINTF(0)("I am: %s colliding with: %s\n", owner->getClassName(), collisionEvent->getEntityB()->getClassName(), *it); 235 // if( collisionEvent->getEntityA() == this->owner) { 236 // PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(), 237 // collisionEvent->getEntityB()->getClassName(), *it); 238 // if( collisionEvent->getEntityB()->isA((ClassID)(*it))) { 239 // PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 240 // collisionEvent->getEntityB()->getClassName(), *it); 241 // } 242 // } 243 // else { 244 // PRINTF(0)("I am not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(), 245 // collisionEvent->getEntityB()->getClassName(), *it); 246 // if( collisionEvent->getEntityA()->isA((ClassID)(*it))) { 247 // PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 248 // collisionEvent->getEntityA()->getClassName(), *it); 249 // } 250 // } 251 // 252 // } 253 231 254 if( collisionEvent->getEntityA() == this->owner) { 232 255 if( collisionEvent->getEntityB()->isA((ClassID)(*it))) { … … 256 279 for(; it < this->targetList.end(); it++) 257 280 { 281 282 // if(collision->getEntityB()->isA(CL_AIMING_SYSTEM) || collision->getEntityA()->isA(CL_AIMING_SYSTEM)) 283 // { 284 // PRINTF(0)("Shared!!! I am: %s colliding with: %s\n", owner->getClassName(), collision->getEntityB()->getClassName(), *it); 285 // if( collision->getEntityA() == this->owner) { 286 // PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(), 287 // collision->getEntityB()->getClassName(), *it); 288 // if( collision->getEntityB()->isA((ClassID)(*it))) { 289 // PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 290 // collision->getEntityB()->getClassName(), *it); 291 // } 292 // } 293 // else { 294 // PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(), 295 // collision->getEntityB()->getClassName(), *it); 296 // if( collision->getEntityA()->isA((ClassID)(*it))) { 297 // PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(), 298 // collision->getEntityA()->getClassName(), *it); 299 // } 300 // } 301 // } 302 258 303 if( collision->getEntityA() == this->owner) { 259 304 if( collision->getEntityA()->isA((ClassID)(*it))) -
trunk/src/lib/collision_reaction/cr_engine.h
r8190 r9235 30 30 CR_PHYSICS_MOMENTUM = 0, //!< physical reaction: conservervation of momentum 31 31 CR_PHYSICS_STEP_BACK, //!< physical reaction: just go to the last position without collisions 32 CR_PHYSICS_GROUND ,//!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force33 CR_PHYSICS_ GROUND_WALK,//!< physical reaction: walking on the ground (inkl. hills etc)32 CR_PHYSICS_GROUND_WALK, //!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force 33 CR_PHYSICS_FULL_WALK, //!< physical reaction: walking on the ground (inkl. hills etc) 34 34 CR_PHYSICS_DAMAGE, //!< physical reaction: daling damage according to the object energy and their structural stability 35 35 -
trunk/src/lib/collision_reaction/cr_object_damage.cc
r9061 r9235 56 56 float damage = 0.0f; 57 57 58 PRINTF( 0)("Dealing damage - Handling collision: %s vs %s\n",58 PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n", 59 59 collision->getEntityA()->getClassName(), 60 60 collision->getEntityB()->getClassName()); -
trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9110 r9235 71 71 72 72 float CR_MAX_WALK_HEIGHT = 15.0f; 73 float CR_THRESHOLD = 0.2f;74 73 75 74 float height = 0.0f; 76 float front = 0.0f;77 float back = 0.0f;78 float right = 0.0f;79 float left = 0.0f;80 75 81 76 … … 94 89 switch( ce->getType()) 95 90 { 96 /* collision in the X-AXIS */97 case COLLISION_TYPE_AXIS_X:98 front = collPos.len() - box->halfLength[0];99 100 // object is beneath the plane (ground)101 if( front <= 0.0f )102 {103 Vector dirX = entity->getAbsDirX();104 dirX.y = 0.0f;105 dirX.normalize();106 Vector backoff = dirX * front;107 108 entity->shiftCoor(backoff);109 }110 else if( ce->isInWall())111 {112 // object is already in the wall113 entity->setAbsCoor(entity->getLastAbsCoor());114 }115 break;116 117 case COLLISION_TYPE_AXIS_X_NEG:118 back = collPos.len() - box->halfLength[0];119 120 // object is beneath the plane (ground)121 if( back <= 0.0f)122 {123 Vector dirX = entity->getAbsDirX();124 dirX.y = 0.0f;125 dirX.normalize();126 Vector backoff = dirX * back * -1.0f;127 128 entity->shiftCoor(backoff);129 }130 else if( ce->isInWall())131 {132 // object is already in the wall133 entity->setAbsCoor(entity->getLastAbsCoor());134 }135 break;136 137 138 91 /* collision in the Y-AXIS */ 139 92 case COLLISION_TYPE_AXIS_Y_NEG: … … 153 106 { 154 107 entity->setAbsCoor(entity->getLastAbsCoor()); 155 PRINTF(0)("ground collision: reset pos\n");156 108 } 157 109 else … … 163 115 164 116 165 /* 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 Vector dirZ = entity->getAbsDirZ();174 dirZ.y = 0.0f;175 dirZ.normalize();176 Vector backoff = dirZ * right;177 entity->shiftCoor(backoff);178 }179 else if( ce->isInWall())180 {181 // object is already in the wall182 entity->setAbsCoor(entity->getLastAbsCoor());183 }184 break;185 186 187 // collision in the z-axis188 case COLLISION_TYPE_AXIS_Z_NEG:189 190 left = collPos.len() - box->halfLength[2];191 192 // object is beneath the plane (ground)193 if( left <= 0.0f )194 {195 Vector dirZ = entity->getAbsDirZ();196 dirZ.y = 0.0f;197 dirZ.normalize();198 Vector backoff = dirZ * left*-1.0f;199 entity->shiftCoor(backoff);200 }201 // object is already in the wall202 else if( ce->isInWall())203 {204 entity->setAbsCoor(entity->getLastAbsCoor());205 }206 break;207 117 } 208 118 } 209 119 //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side); 210 211 212 213 214 215 216 120 217 121 }
Note: See TracChangeset
for help on using the changeset viewer.