[Orxonox-commit 4700] r9371 - in code/branches/release2012: data/levels src/modules/objects

jo at orxonox.net jo at orxonox.net
Thu Sep 6 14:16:42 CEST 2012


Author: jo
Date: 2012-09-06 14:16:41 +0200 (Thu, 06 Sep 2012)
New Revision: 9371

Modified:
   code/branches/release2012/data/levels/underAttack.oxw
   code/branches/release2012/src/modules/objects/SpaceBoundaries.cc
Log:
The UnderAttack level was improved. The defender's spawnpoints have been rearranged such that they don't get stuck in the Transporter. In order to catch bots that are too far away from the transporter a spaceboundary damages spaceships that are too far away from the transporter. Therefore the spaceboundary's code has to be updated to enable it to be moved around.

Modified: code/branches/release2012/data/levels/underAttack.oxw
===================================================================
--- code/branches/release2012/data/levels/underAttack.oxw	2012-09-04 16:13:03 UTC (rev 9370)
+++ code/branches/release2012/data/levels/underAttack.oxw	2012-09-06 12:16:41 UTC (rev 9371)
@@ -45,10 +45,26 @@
       </MovableEntity>
     <?lua end ?>
 
+<!--- A SpaceBoundary moving along with the transporter, in order to filter out bots that are too far away from the transporter ---->
+      <MovableEntity
+          position="0,0,0"
+          velocity="-35,0,0"
+      >
+        <attached>
+            <SpaceBoundaries position="1,2,3" maxDistance="1600" warnDistance="300" showDistance="300" reactionMode="1" healthDecrease="5.0" />
+          <BlinkingBillboard
+            position="0,0,0"
+            material="Flares/ringflare2"
+            colour="1.0, 0.5, 0.3"
+            phase="-180"
+            amplitude=0.1
+            frequency=0.5
+            quadratic=1
+          />
+        </attached>
+      </MovableEntity>
 
 
-
-
     <Destroyer
       position          = "100,150,0"
       collisionType     = dynamic
@@ -62,15 +78,15 @@
     >
 
       <attached>
-        <TeamSpawnPoint team=1 position="150,0,-50" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
-        <TeamSpawnPoint team=1 position="0,0,-50" lookat="-1,0,0" roll="90"  yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
-        <TeamSpawnPoint team=1 position="-50,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+        <TeamSpawnPoint team=1 position="200,0,20" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+        <TeamSpawnPoint team=1 position="50,0,100" lookat="-1,0,0" roll="90"  yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+        <TeamSpawnPoint team=1 position="-200,0,20" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
         <TeamSpawnPoint team=1 position="100,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
-        <TeamSpawnPoint team=1 position="50,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+        <TeamSpawnPoint team=1 position="400,0,20" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
         <?lua for i = 1, 100, 1 do ?>
           <TeamSpawnPoint
             team=0
-            position="<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"
+            position="<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"
             lookat="0,0,0"
             spawnclass=SpaceShip
             pawndesign=spaceshipassff

Modified: code/branches/release2012/src/modules/objects/SpaceBoundaries.cc
===================================================================
--- code/branches/release2012/src/modules/objects/SpaceBoundaries.cc	2012-09-04 16:13:03 UTC (rev 9370)
+++ code/branches/release2012/src/modules/objects/SpaceBoundaries.cc	2012-09-06 12:16:41 UTC (rev 9371)
@@ -116,7 +116,7 @@
         this->billboards_[current].billy->setColour(ColourValue(1, 1, 1, alpha));
         this->billboards_[current].usedYet = true;
 
-        Vector3 directionVector = (this->getPosition() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere
+        Vector3 directionVector = (this->getWorldPosition() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere
         this->billboards_[current].billy->setCommonDirection(directionVector);
 
         Vector3 upVector = Vector3(directionVector.z, directionVector.z, -(directionVector.x + directionVector.y)); // vector perpendicular to the direction vector
@@ -251,8 +251,8 @@
     {
         if(item != NULL)
         {
-            Vector3 itemPosition = item->getPosition();
-            return (itemPosition.distance(this->getPosition()));
+            Vector3 itemPosition = item->getWorldPosition();
+            return (itemPosition.distance(this->getWorldPosition()));
         } else {
             return -1;
         }
@@ -266,17 +266,17 @@
     void SpaceBoundaries::displayBoundaries(Pawn *item, float alpha)
     {
 
-        Vector3 direction = item->getPosition() - this->getPosition();
+        Vector3 direction = item->getWorldPosition() - this->getWorldPosition();
         direction.normalise();
 
-        Vector3 boundaryPosition = this->getPosition() + direction * this->maxDistance_;
+        Vector3 boundaryPosition = this->getWorldPosition() + direction * this->maxDistance_;
 
         this->positionBillboard(boundaryPosition, alpha);
     }
 
     void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt)
     {
-        Vector3 normal = item->getPosition() - this->getPosition();
+        Vector3 normal = item->getWorldPosition() - this->getWorldPosition();
         normal.normalise();
         Vector3 velocity = item->getVelocity();
         float normalSpeed = item->getVelocity().dotProduct(normal);
@@ -299,12 +299,12 @@
         Vector3 acceleration = item->getAcceleration();
         acceleration = acceleration.reflect(*normal);
 
-        item->lookAt( *velocity + this->getPosition() );
+        item->lookAt( *velocity + this->getWorldPosition() );
 
         item->setAcceleration(acceleration * dampingFactor);
         item->setVelocity(*velocity * dampingFactor);
 
-        item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
+        item->setPosition( item->getWorldPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
     }
 
     bool SpaceBoundaries::isHumanPlayer(Pawn *item)




More information about the Orxonox-commit mailing list