Changeset 8922 in orxonox.OLD for branches/single_player_map/src/lib/collision_reaction
- Timestamp:
- Jun 29, 2006, 9:48:25 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8915 r8922 63 63 // normal.normalize(); 64 64 65 // put it back66 // PRINTF(0)("putting it back to lastPos: \n");67 //this->lastPositions[0].debug();68 // PRINTF(0)("current pos:\n");69 collision->getEntityB()->getAbsCoor().debug();70 71 72 65 73 66 float height; … … 80 73 return; 81 74 } 82 83 75 76 84 77 // collision position maths 85 78 Vector collPos = collision->getEntityB()->getAbsCoor() + box->center - ce->getCollisionPosition(); … … 91 84 //PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 92 85 // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 93 // 86 // 94 87 95 88 switch( ce->getType()) 96 89 { 97 90 98 91 case COLLISION_TYPE_AXIS_X: 99 // PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 100 // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 101 // PRINTF(0)("COLLISION_TYPE_AXIS_X \n"); 102 break; 103 case COLLISION_TYPE_AXIS_Y: 92 93 break; 94 95 case COLLISION_TYPE_AXIS_Y: 104 96 105 97 height = collPos.y - box->halfLength[1]; 106 // PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 107 // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 108 // PRINTF(0)("COLLISION_TYPE_AXIS_Y \n"); 109 // // object is beneath the plane (ground) 110 // if( height <= 0.0f ) 111 // { 112 // entity->shiftCoor(Vector(0, -height, 0)); 113 // } 114 // // object is already in the wall 115 // else if( ce->isInWall()) 116 // { 117 // entity->setAbsCoor(entity->getLastAbsCoor()); 118 // } 119 // break; 120 break; 121 122 98 99 PRINTF(0)("height: %f\n", height); 100 PRINTF(0)("in wall %i\n", ce->isInWall()); 101 102 // object is beneath the plane (ground) 103 if( height <= 0.0f ) 104 { 105 entity->shiftCoor(Vector(0, -height, 0)); 106 } 107 // object is already in the wall 108 else if( ce->isInWall()) 109 { 110 entity->setAbsCoor(entity->getLastAbsCoor()); 111 } 112 break; 113 break; 114 115 123 116 case COLLISION_TYPE_AXIS_Z: 124 // PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 125 // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 126 // PRINTF(0)("COLLISION_TYPE_AXIS_Z \n"); 127 break; 128 129 } 117 118 break; 119 120 } 130 121 131 122 … … 143 134 144 135 145 if( box != NULL) { 146 147 148 if(ce->getCollisionPosition().x <= 0.9 && ce->getGroundNormal().len() <= 1.4f) { 136 if( box != NULL) 137 { 138 139 140 if(ce->getCollisionPosition().x <= 0.9 && ce->getGroundNormal().len() <= 1.4f) 141 { 149 142 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor()); 150 143 return; 151 144 } 152 if(ce->getCollisionPosition().z <= 0.9 && ce->getGroundNormal().len() <= 1.4f) { 145 if(ce->getCollisionPosition().z <= 0.9 && ce->getGroundNormal().len() <= 1.4f) 146 { 153 147 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor()); 154 148 return; 155 149 } 156 150 157 if(ce->getGroundNormal().len() <= 0.1f) { 151 if(ce->getGroundNormal().len() <= 0.1f) 152 { 158 153 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor()); 159 154 return; … … 161 156 162 157 163 if(ce->getGroundNormal().len() >= 1.4f) { 158 if(ce->getGroundNormal().len() >= 1.4f) 159 { 164 160 downspeed++; 165 161 collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.08*downspeed,0.0)); … … 181 177 182 178 } 183 else { 179 else 180 { 184 181 if(height.y < box->halfLength[1] + 0.0f /* && height.y > - 55.0f*/) // below ground 185 182 { … … 212 209 void CRPhysicsGroundWalk::update(WorldEntity* owner) 213 210 { 214 215 211 } 216 212
Note: See TracChangeset
for help on using the changeset viewer.