- Timestamp:
- Jul 3, 2006, 7:22:44 PM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9061 r9065 102 102 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); 103 103 Vector backoff = dirX * front; 104 104 105 105 entity->setAbsCoor(entity->getLastAbsCoor()); 106 106 // entity->shiftCoor(backoff); … … 112 112 } 113 113 break; 114 114 115 115 case COLLISION_TYPE_AXIS_X_NEG: 116 116 front = collPos.len() - box->halfLength[0]; // should be [0] … … 121 121 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); 122 122 Vector backoff = dirX * front * -1.0f; 123 123 124 124 entity->setAbsCoor(entity->getLastAbsCoor()); 125 125 // entity->shiftCoor(backoff); … … 134 134 135 135 // collision in the y-axis 136 case COLLISION_TYPE_AXIS_Y _NEG:136 case COLLISION_TYPE_AXIS_Y: 137 137 // calulate the height above ground 138 138 height = collPos.y - box->halfLength[1]; … … 179 179 } 180 180 break; 181 182 181 182 183 183 // collision in the z-axis 184 184 case COLLISION_TYPE_AXIS_Z_NEG: … … 189 189 if( side <= 0.0f ) 190 190 { 191 191 192 192 Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize(); 193 193 Vector backoff = dirZ * side*-1.0f; -
branches/presentation/src/lib/graphics/importer/bsp_manager.cc
r9061 r9065 985 985 986 986 987 plane* testPlane; 988 989 bool xCollision = false; 990 bool zCollision = false; 991 987 992 988 993 float height = 40; … … 998 1003 dest1 = worldEntity->getAbsCoor() + box->center + dirX * (box->halfLength[0] + BSP_X_OFFSET); 999 1004 dest2 = worldEntity->getAbsCoor() - box->center + dirX * (box->halfLength[0] + BSP_X_OFFSET); 1000 1005 1001 1006 Vector dirZ = worldEntity->getAbsDirZ(); dirX.y = 0.0f; dirZ.normalize(); 1002 1007 //position2 = worldEntity->getAbsCoor() + box->center - dirZ * (box->halfLength[2] + BSP_Z_OFFSET); … … 1009 1014 1010 1015 1011 // PRINTF(0)("x and v\n"); 1012 // worldEntity->getAbsDirX().debug(); 1013 // worldEntity->getAbsDirV().debug(); 1014 1015 1016 // 1st Ray 1016 1017 // 1st Ray: Y RAY 1017 1018 this->inputStart = position; 1018 1019 this->inputEnd = dest; … … 1052 1053 this->out = out; 1053 1054 } 1054 1055 1056 } 1057 1058 plane* testPlane = this->collPlane; 1059 1060 bool xCollision = false; 1061 bool zCollision = false; 1055 } 1056 testPlane = this->collPlane; 1057 1058 1062 1059 bool xCollisionNeg = false; 1063 1060 bool zCollisionNeg = false; 1064 1065 1066 1067 // 2nd Collision Detection 1061 1062 1063 1064 // 2nd Collision Detection X-RAY 1068 1065 this->outputStartsOut = true; 1069 1066 this->outputAllSolid = false; … … 1093 1090 1094 1091 1095 // 3rd Collision Detection 1092 // 3rd Collision Detection Z-RAY 1096 1093 this->outputStartsOut = true; 1097 1094 this->outputAllSolid = false; … … 1121 1118 } 1122 1119 1123 //end if1124 /*1125 This is how you would calculate the Coordinates where worldEntity Collided with the BSP world.1126 out.x = position1.x + (dest.x -position1.x) * this->outputFraction;1127 out.z = position1.z + (dest.z -position1.z) * this->outputFraction;1128 */1129 1130 1120 1131 1121 // Return the normal here: Normal's stored in this->collPlane; 1132 1122 if( collision) { 1133 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y _NEG, this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);1123 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1134 1124 } 1135 1125 if(xCollision) { 1136 1126 worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag); 1137 1127 } 1138 1128 1139 1129 if(zCollision) { 1140 1130 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag); 1141 1131 } 1142 1132 1143 1144 //else worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false);1145 1133 1146 1134 } -
branches/presentation/src/world_entities/npcs/generic_npc.cc
r9061 r9065 93 93 94 94 // collision reaction registration 95 //this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);95 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY); 96 96 } 97 97 … … 194 194 void GenericNPC::resume() 195 195 { 196 //if() 196 if( this->animationStack.size() == 0) 197 return; 198 197 199 delete this->behaviourList; 198 200 this->behaviourList = this->animationStack.top(); … … 518 520 { 519 521 Vector dest = currentAnimation.v - this->getAbsCoor(); 522 dest.y = 0.0f; 520 523 if (dest.len() < .5) 521 524 this->nextStep(); … … 530 533 { 531 534 Vector dest = currentAnimation.v - this->getAbsCoor(); 535 dest.y = 0.0f; 532 536 if (dest.len() < .5) 533 537 this->nextStep();
Note: See TracChangeset
for help on using the changeset viewer.