- Timestamp:
- Jul 4, 2006, 2:16:16 PM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/defs/class_id.h
r9061 r9123 276 276 CL_COLLISION_REACTION = 0X00000713, 277 277 CL_CR_PHYSICS_MOMENTUM = 0X00000714, 278 CL_CR_PHYSICS_GROUND 279 CL_CR_PHYSICS_ GROUND_WALK= 0X00000716,278 CL_CR_PHYSICS_GROUND_WALK = 0X00000715, 279 CL_CR_PHYSICS_FULL_WALK = 0X00000716, 280 280 CL_CR_OBJECT_DAMAGE = 0X00000717, 281 281 CL_CR_OBJECT_PICKUP = 0X00000718, -
branches/presentation/src/lib/collision_reaction/Makefile.am
r8490 r9123 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 -
branches/presentation/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9110 r9123 74 74 75 75 float height = 0.0f; 76 float front = 0.0f; 77 float back = 0.0f; 78 float right = 0.0f; 79 float left = 0.0f; 76 80 77 81 78 … … 94 91 switch( ce->getType()) 95 92 { 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 93 /* collision in the Y-AXIS */ 139 94 case COLLISION_TYPE_AXIS_Y_NEG: … … 153 108 { 154 109 entity->setAbsCoor(entity->getLastAbsCoor()); 155 PRINTF(0)("ground collision: reset pos\n");156 110 } 157 111 else … … 163 117 164 118 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 119 } 208 120 } 209 121 //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side); 210 211 212 213 214 215 216 122 217 123 } -
branches/presentation/src/world_entities/creatures/fps_player.cc
r9122 r9123 191 191 this->getWeaponManager().getFixedTarget()->setParent(State::getCameraTargetNode()); 192 192 this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0); 193 193 194 } 194 195 … … 208 209 { 209 210 210 if( this->bPosBut) 211 { 212 this->bPosBut = false; 211 if( this->bJump) 212 { 213 213 printf("mechanic2:walkTo( %f, mtheight, %f)\n",this->getAbsCoorX(),this->getAbsCoorZ()); 214 214 } … … 373 373 else if( event.type == KeyMapper::PEV_JUMP) 374 374 this->bJump = event.bPressed; 375 this->bPosBut = event.bPressed;376 375 } 377 376 … … 379 378 { 380 379 Playable::respawn(); 381 380 382 381 AABB* box = this->getModelAABB(); 383 382 if( box != NULL)
Note: See TracChangeset
for help on using the changeset viewer.