[Orxonox-commit 7369] r11985 - code/branches/OrxyRoad_FS18/src/modules/orxyroad

jacobsr at orxonox.net jacobsr at orxonox.net
Thu May 24 14:39:49 CEST 2018


Author: jacobsr
Date: 2018-05-24 14:39:49 +0200 (Thu, 24 May 2018)
New Revision: 11985

Modified:
   code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc
Log:
distance variation between obejcts\

Modified: code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc
===================================================================
--- code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc	2018-05-24 12:25:15 UTC (rev 11984)
+++ code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc	2018-05-24 12:39:49 UTC (rev 11985)
@@ -95,7 +95,8 @@
     }
     int OrxyRoad::generateStreet(int type, OrxyRoadShip* player){
         int trafficVelocities[]= {200,1400,500, 300};
-        int numObjects[] = {60,100,40,60}; // default, spaceship, sattellite, asteroid per track
+        int velocityVariation[] = {40,80,100,20};
+        int numObjects[] = {60,40,30,40}; // default, spaceship, sattellite, asteroid per track
         int streetSize[] = {3 , 1, 2, 4};
         int trackWidth = 700;
       
@@ -103,7 +104,7 @@
             {
                 int sign = rand()%2;
 
-                orxout(internal_error) << sign<< endl;
+                //orxout(internal_error) << sign<< endl;
                 
                 
 
@@ -149,17 +150,18 @@
 
                         }
 
-                        int distance = trafficVelocities[type]*3; //Todo better calculation of distance between objects
+                        int posVar = rand()%2;
+                        int distance = trafficVelocities[type]*3 +posVar*trafficVelocities[type]/10; //Todo better calculation of distance between objects
                        
-                        cube->setPosition(player->getWorldPosition() + Vector3(1000.0f+j*trackWidth, 0.0f, i*distance+j*trackWidth));
+                        cube->setPosition(player->getWorldPosition() + Vector3(2000.0f+j*trackWidth, 0.0f, i*distance));
                         
                         /* experimental */
                         
 
                         if(sign>=1){
-                            cube->setVelocity(0,0,trafficVelocities[type]);
+                            cube->setVelocity(0,0,trafficVelocities[type]*level+velocityVariation[j%3]);
                         } else{
-                             cube->setVelocity(0,0,-trafficVelocities[type]);
+                             cube->setVelocity(0,0,-trafficVelocities[type]*level+velocityVariation[j%3]);
                         }
                         
 
@@ -192,7 +194,7 @@
 
             for(unsigned int i=0; i < cubeList.size();i++)
             {
-                if(cubeList.at(i)->getPosition().x < currentPosition-3000)
+                if(cubeList.at(i)->getPosition().x < currentPosition-500)
                 {
                     cubeList.at(i)->destroy();
                     cubeList.erase(cubeList.begin()+i);
@@ -202,7 +204,7 @@
             
 
 
-            if(counter >= roadWidth)
+            if(counter >= roadWidth-200)
             {
                 int type  = rand() % 4;
                 orxout(user_info) << "Random : "<<type<< endl;



More information about the Orxonox-commit mailing list