Changeset 8699 in orxonox.OLD for branches/bsp_model/src/lib/collision_reaction
- Timestamp:
- Jun 22, 2006, 2:32:46 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8693 r8699 23 23 #include "world_entity.h" 24 24 #include "cr_physics_ground_walk.h" 25 26 #include "aabb.h" 27 28 #include "debug.h" 25 29 26 30 #include <vector> … … 56 60 Vector normal = ce->getGroundNormal(); 57 61 62 AABB* box = ce->getEntityB()->getModelAABB(); 58 63 59 Vector height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor(); 60 if(ce->getGroundNormal().len() <= 0.1f) 64 Vector center = ce->getEntityB()->getAbsCoor() /*+ box->center*/; 65 Vector collisionPos = ce->getCollisionPosition() - center; 66 67 float objSize = box->halfLength[1]; 68 69 if( normal.len() <= 0.1f) 61 70 { 62 71 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor()); 63 72 return; 64 73 } 65 if(height.y < -3.6) 74 75 if( collisionPos.y <= -(objSize + 0.1f)) 66 76 { 67 77 downspeed++; 68 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.03*downspeed,0.0)); 69 78 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -0.03 * downspeed, 0.0)); 70 79 } 71 80 else 72 81 { 73 if(height.y > -3.5 && height.y < 3.9) 82 if( collisionPos.y > -objSize && 83 collisionPos.y < (objSize + 0.4)) 74 84 { 75 85 //if(downspeed <= 0) downspeed =1; 76 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,height.y+3.55,0.0));77 //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0));86 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + 87 Vector(0.0, collisionPos.y + objSize + 0.1, 0.0)); 78 88 } 79 89 downspeed = 0; … … 81 91 82 92 83 /*84 PRINTF(0)("Collision with Ground: \n");85 collision->getEntityB()->getAbsCoor().debug();86 collision->getEntityB()->setVelocity(Vector());87 collision->getEntityB()->setAbsCoor(this->lastPositions[1]);88 89 */90 93 } 91 94
Note: See TracChangeset
for help on using the changeset viewer.