[Orxonox-commit 7379] r11996 - code/branches/OrxyRoad_FS18/src/modules/orxyroad

jacobsr at orxonox.net jacobsr at orxonox.net
Thu May 24 15:54:42 CEST 2018


Author: jacobsr
Date: 2018-05-24 15:54:42 +0200 (Thu, 24 May 2018)
New Revision: 11996

Modified:
   code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc
   code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.cc
Log:
Changed parameters for velocity

Modified: code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc
===================================================================
--- code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc	2018-05-24 13:43:28 UTC (rev 11995)
+++ code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoad.cc	2018-05-24 13:54:42 UTC (rev 11996)
@@ -96,7 +96,7 @@
     int OrxyRoad::generateStreet(int type, OrxyRoadShip* player){
         int trafficVelocities[]= {200,1400,500, 300};
         int velocityVariation[] = {40,80,100,20};
-        int numObjects[] = {60,40,30,40}; // default, spaceship, sattellite, asteroid per track
+        int numObjects[] = {30,30,30,30}; // default, spaceship, satellite, asteroid per track
         int streetSize[] = {3 , 1, 2, 4};
         int trackWidth = 700;
       
@@ -113,6 +113,7 @@
                         OrxyRoadCube* cube = new OrxyRoadCube(this->center_->getContext());
                         cubeList.push_back(cube);
                         int templateType = rand()%2;
+
                         switch(type)
                         {
                         case 0 :
@@ -136,7 +137,7 @@
                                 cube->addTemplate("satellite");//satellite
                             }else {
                                 cube->addTemplate("satellite");//satellite
-                            }                      
+                            }                    
 
                             
                         break;
@@ -207,7 +208,7 @@
             if(counter >= roadWidth-200)
             {
                 int type  = rand() % 4;
-                orxout(user_info) << "Random : "<<type<< endl;
+                //orxout(user_info) << "Random : "<<type<< endl;
 
                 roadWidth = generateStreet(type,player);//Generate street to specific type type = 0 default, type = 1 space ship type  = 2 statellite/cubes, type = 3 asteroids 
                 counter = 0;                

Modified: code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.cc
===================================================================
--- code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.cc	2018-05-24 13:43:28 UTC (rev 11995)
+++ code/branches/OrxyRoad_FS18/src/modules/orxyroad/OrxyRoadShip.cc	2018-05-24 13:54:42 UTC (rev 11996)
@@ -61,7 +61,7 @@
         //orxout(user_info) << "This is some cool output!" << endl;
 
         Vector3 pos = getPosition();
-        Vector3 pos1 = getPosition();
+        //Vector3 pos1 = getPosition();
 
         //Movement calculation
         lastTimeFront += dt * damping;
@@ -76,11 +76,11 @@
         
         if (this->hasLocalController())
         {
-            float dist_y = velocity.y * dt;
+            //float dist_y = velocity.y * dt;
             //forward backwards movement
             if(forward){
-                if(velocity.y < 200){// Limit for max velocity
-                    velocity.y += 10;
+                if(velocity.y < 300){// Limit for max velocity
+                    velocity.y += 30;
                     forward = false;
                 }
                 
@@ -87,7 +87,7 @@
 
             }else if(backward){
                 if(velocity.y > 10){
-                     velocity.y -= 10; 
+                     velocity.y -= 30; 
                 }else {
                     velocity.y = 0; // Prevent players from going backwards
                 }
@@ -118,19 +118,23 @@
 
             //Left right steering
 
+            if(!steeredLeft&&!steeredRight){
+                    velocity.x = velocity.x *0.8;
+            }
 
             if(steeredLeft){
-                if(true){//if(!forward) Experimental for only allowing steering left and right when
-                    velocity.x += 5;
+                steeredLeft = false;
+                if(velocity.x<100){//if(!forward) Experimental for only allowing steering left and right when
+                    velocity.x += 6;
                     steeredLeft = false;
-                }
-                
+                }              
 
             }else if(steeredRight) {
-                if(true){
-                    velocity.x += -5;
+                steeredRight = false;
+                if(velocity.x>-100){
+                    velocity.x += -6;
                     steeredRight = false;
-                }
+                }       
             }else {
                 if(velocity.x < -2 || velocity.x > 2 ){
                     velocity.x  = velocity.x *0.9;



More information about the Orxonox-commit mailing list