Changeset 10355 in orxonox.OLD for branches/ODE/src/lib/collision_reaction
- Timestamp:
- Jan 24, 2007, 8:48:26 PM (18 years ago)
- Location:
- branches/ODE
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/ODE/src/lib/collision_reaction/cr_physics_full_walk.cc
r10013 r10355 53 53 {} 54 54 55 55 56 56 /** 57 57 * caluculates and applys the reaction to a specific collision … … 60 60 void CRPhysicsFullWalk::reactToCollision(Collision* collision) 61 61 { 62 //PRINTF(0)("REACTION..................HEHEHEHEH:-)\n"); 62 63 63 64 AABB* box = collision->getEntityA()->getModelAABB(); … … 66 67 if( box == NULL) 67 68 { 68 PRINTF( 2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");69 PRINTF(0)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n"); 69 70 return; 70 71 } … … 91 92 Vector collPos = collision->getEntityA()->getAbsCoor() + box->center - ce->getCollisionPosition(); 92 93 94 93 95 // test the 3 axis differently 94 96 switch( ce->getType()) … … 96 98 /* collision in the X-AXIS */ 97 99 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X: 98 front = collPos.len() - box->halfLength[0]; 100 101 // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n"); 102 front = (collPos- entity->getAbsCoor()).len() - box->halfLength[0]; 99 103 100 104 // object is beneath the plane (ground) 101 105 if( front <= 0.0f ) 102 106 { 107 // PRINTF(0)("FRONT"); 103 108 Vector dirX = entity->getAbsDirX(); 104 109 dirX.y = 0.0f; … … 116 121 117 122 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG: 123 124 // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n"); 118 125 back = collPos.len() - box->halfLength[0]; 119 126 … … 121 128 if( back <= 0.0f) 122 129 { 130 // PRINTF(0)("FRONT"); 123 131 Vector dirX = entity->getAbsDirX(); 124 132 dirX.y = 0.0f; … … 136 144 137 145 146 147 148 138 149 /* collision in the Y-AXIS */ 139 150 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG: 140 151 // calulate the height above ground 141 height = collPos.len()- box->halfLength[1];142 143 152 height = height = collPos.dot(Vector(0.0,1.0,0.0)) - box->halfLength[1] ; // collPos.len() - box->halfLength[1]; 153 // PRINTF(0)("HEIGHT : %f \n" , height); 154 144 155 // object is beneath the plane (ground) 145 156 // if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing 146 if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT) 147 { 148 entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f)); 157 if(height < 10.0f )//&& -height < CR_MAX_WALK_HEIGHT) 158 { 159 160 entity->shiftCoor(Vector(0.0f,-(height -10.0f) + 0.0001, 0.0f)); 161 //entity->setVelocity(Vector(entity->getVelocity().x, entity->getVelocity().y,entity->getVelocity().z)); 162 //entity->setAbsCoor(Vector(entity->getAbsCoor().x, entity->getLastAbsCoor().y+ 100.0*(entity->getAbsCoor()-entity->getLastAbsCoor()).len(),entity->getAbsCoor().z) ); 163 // PRINTF(0)("Geschw. %f\n",(0.0f)); 164 // PRINTF(0)("ENTITY:. %s\n",entity->getCName()); 165 149 166 entity->setOnGround(true); 150 167 } … … 153 170 { 154 171 entity->setAbsCoor(entity->getLastAbsCoor()); 155 PRINTF(0)("ground collision: reset pos\n");172 // PRINTF(0)("ground collision: reset pos\n"); 156 173 } 157 174 else … … 166 183 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z: 167 184 185 //PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n"); 168 186 right = collPos.len() - box->halfLength[2]; 169 187 … … 187 205 // collision in the z-axis 188 206 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG: 189 207 208 // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n"); 190 209 left = collPos.len() - box->halfLength[2]; 191 210
Note: See TracChangeset
for help on using the changeset viewer.