Changeset 9050 in orxonox.OLD for branches/single_player_map/src/lib/collision_reaction
- Timestamp:
- Jul 3, 2006, 5:08:54 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9003 r9050 95 95 // collision in the x-axis 96 96 case COLLISION_TYPE_AXIS_X: 97 front = collPos. x- box->halfLength[0]; // should be [0]97 front = collPos.len() - box->halfLength[0]; // should be [0] 98 98 99 99 // object is beneath the plane (ground) 100 100 if( front <= 0.0f ) 101 101 { 102 Vector backoff = entity->getAbsDirX() * front; 103 // entity->shiftCoor(backoff); 102 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); 103 Vector backoff = dirX * front; 104 entity->shiftCoor(backoff); 104 105 } 105 106 // object is already in the wall … … 118 119 119 120 // object is beneath the plane (ground) 120 if( height <= 0.0f ) 121 { 122 entity->shiftCoor(Vector(0.0f, -height, 0.0f)); 121 if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing 122 else if( height < 0.0f ) 123 { 124 entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f)); 123 125 entity->setOnGround(true); 124 126 } … … 139 141 case COLLISION_TYPE_AXIS_Z: 140 142 141 side = collPos. z- box->halfLength[2]; // should be [2]143 side = collPos.len() - box->halfLength[2]; // should be [2] 142 144 143 145 // object is beneath the plane (ground) 144 146 if( side <= 0.0f ) 145 147 { 146 Vector backoff = entity->getAbsDirX() * side; 147 // entity->shiftCoor(backoff); 148 149 Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize(); 150 Vector backoff = dirZ * side; 151 // entity->shiftCoor(backoff); 148 152 } 149 153 // object is already in the wall … … 155 159 } 156 160 } 157 //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);161 PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side); 158 162 159 163
Note: See TracChangeset
for help on using the changeset viewer.