Changeset 9945 for code/trunk/src/modules/gametypes
- Timestamp:
- Jan 3, 2014, 1:50:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/gametypes/SpaceRaceController.cc
r9667 r9945 464 464 currentShape->getBoundingSphere(positionObject,radiusObject); 465 465 Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z()); 466 467 468 469 466 Vector3 norm_r_CP = cP1ToCP2.crossProduct(centerCP1-positionObjectNonBT); 467 468 if(norm_r_CP.length() == 0){ 469 Vector3 zufall; 470 470 do{ 471 471 zufall=Vector3(rnd(),rnd(),rnd());//random 472 472 }while((zufall.crossProduct(cP1ToCP2)).length() == 0); 473 474 475 476 477 473 norm_r_CP=zufall.crossProduct(cP1ToCP2); 474 } 475 Vector3 VecToVCP = norm_r_CP.crossProduct(cP1ToCP2); 476 float distanzToCP1 = sqrt(powf(radiusObject,4)/(powf((centerCP1-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2)); 477 float distanzToCP2 = sqrt(powf(radiusObject,4)/(powf((racepoint2->getPosition()-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2)); 478 478 float distanz = std::max(distanzToCP1,distanzToCP2); 479 480 481 482 483 484 485 486 487 488 489 490 479 //float distanz = 0.0f; //TEMPORARY 480 Vector3 newCheckpointPositionPos = positionObjectNonBT+(distanz*VecToVCP)/VecToVCP.length(); 481 Vector3 newCheckpointPositionNeg = positionObjectNonBT-(distanz*VecToVCP)/VecToVCP.length(); 482 if((newCheckpointPositionPos - centerCP1).length() + (newCheckpointPositionPos - (centerCP1+cP1ToCP2)).length() < (newCheckpointPositionNeg - centerCP1).length() + (newCheckpointPositionNeg - (centerCP1+cP1ToCP2)).length() ) 483 { 484 RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionPos); 485 } 486 else 487 { 488 RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionNeg); 489 } 490 return; 491 491 } 492 492 }
Note: See TracChangeset
for help on using the changeset viewer.