[Orxonox-commit 2227] r6943 - in code/branches/rocket: data/levels src/modules/weapons src/modules/weapons/weaponmodes

gnadler at orxonox.net gnadler at orxonox.net
Thu May 20 21:04:47 CEST 2010


Author: gnadler
Date: 2010-05-20 21:04:46 +0200 (Thu, 20 May 2010)
New Revision: 6943

Modified:
   code/branches/rocket/data/levels/tutorial.oxw
   code/branches/rocket/src/modules/weapons/RocketController.cc
   code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
Log:


Modified: code/branches/rocket/data/levels/tutorial.oxw
===================================================================
--- code/branches/rocket/data/levels/tutorial.oxw	2010-05-20 18:30:38 UTC (rev 6942)
+++ code/branches/rocket/data/levels/tutorial.oxw	2010-05-20 19:04:46 UTC (rev 6943)
@@ -15,7 +15,7 @@
 
 <Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
   <attached>
-    <Model scale="10" mesh="drone.mesh"/>
+    <Model scale="1" mesh="drone.mesh"/>
   </attached>
   <collisionShapes>
     <BoxCollisionShape position="0,0,0"      halfExtents="10, 10, 10" />
@@ -24,7 +24,7 @@
 
 <Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
   <attached>
-    <Model scale="10" mesh="rocket.mesh"/>
+    <Model scale="1" mesh="rocket.mesh"/>
   </attached>
   <collisionShapes>
     <BoxCollisionShape position="0,0,0"      halfExtents="10, 10, 10" />

Modified: code/branches/rocket/src/modules/weapons/RocketController.cc
===================================================================
--- code/branches/rocket/src/modules/weapons/RocketController.cc	2010-05-20 18:30:38 UTC (rev 6942)
+++ code/branches/rocket/src/modules/weapons/RocketController.cc	2010-05-20 19:04:46 UTC (rev 6943)
@@ -62,16 +62,12 @@
     void RocketController::tick(float dt)
     {
 		haha++;
-		
 
-        SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity());
-		if (haha<30)rocket->setVelocity(rocket->getVelocity()*1.03);
+		//if (haha<30)this->rocket->setVelocity(rocket->getVelocity()*1.03);
 		if (this->target_) {
 			this->setTargetPosition();
 			this->moveToTargetPosition();
-		
 		}
-		
 		if (haha>500) rocket->setDestroy();;
 	
 	}
@@ -84,8 +80,8 @@
 	}
 
 	void RocketController::setTargetPosition() {
-		this->targetPosition_=this->target_->getPosition();
-		//this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getPosition(), this->target_->getVelocity());
+		//this->targetPosition_=this->target_->getWorldPosition();
+		this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getPosition(), this->target_->getVelocity());
 	}
 	void RocketController::moveToTargetPosition() {
 		this->moveToPosition(this->targetPosition_);
@@ -102,19 +98,41 @@
     {
        if (!this->getControllableEntity())
             return;
-
-	   COUT(0)<<"moving";
-
+	   float dx = target.x-this->getControllableEntity()->getPosition().x;
+	   float dy = target.y-this->getControllableEntity()->getPosition().y;
+	   COUT(0)<<"\n diff: ";
+	   COUT(0)<<target.x-this->getControllableEntity()->getPosition().x;
+	   COUT(0)<<" ";
+	   COUT(0)<<target.y-this->getControllableEntity()->getPosition().y;
+	   COUT(0)<<" ";
+	   COUT(0)<<target.z-this->getControllableEntity()->getPosition().z;
+	   //COUT(0)<<"\n 2D view: ";
+	  /* COUT(0)<<this->getControllableEntity()->getPosition().x;
+	   COUT(0)<<" ";
+	   COUT(0)<<this->getControllableEntity()->getPosition().y;
+	   COUT(0)<<" ";
+	   COUT(0)<<this->getControllableEntity()->getPosition().z;
+	   COUT(0)<<"\n";*/
         Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
         float distance = (target - this->getControllableEntity()->getPosition()).length();
-
-        if (this->target_ || distance > 10)
-        {
-            // Multiply with 0.8 to make them a bit slower
-			 this->getControllableEntity()->rotateYaw(-0.2f * sgn(coord.x) * coord.x*coord.x);
-            this->getControllableEntity()->rotatePitch(0.2f * sgn(coord.y) * coord.y*coord.y);
-			
-        }
+		//Vector3D diff =target-this->rocket->getPosition();
+		//COUT(0)<<coord.x;
+		//COUT(0)<<"  ";
+		//COUT(0)<<coord.y;
+		 this->getControllableEntity()->rotateYaw(coord.x*coord.x*coord.x*coord.x);
+            this->getControllableEntity()->rotatePitch(coord.y*coord.y* coord.y*coord.y);
+		//this->getControllableEntity()->rotatePitch(rotation.getPitch().valueRadians());
+		//this->getControllableEntity()->rotateYaw(rotation.getYaw().valueRadians());
+		//this->getControllableEntity()->moveUpDown(coord.y);
+		//this->getControllableEntity()->moveRightLeft(coord.x);
+		//this->getControllableEntity()->rotatePitch(coord);
+   //     if (this->target_ || distance > 10)
+   //     {
+   //         // Multiply with 0.8 to make them a bit slower
+			//this->getControllableEntity()->rotateYaw(coord.x );
+   //         this->getControllableEntity()->rotatePitch(coord.y);
+			//
+   //     }
     }
 
 

Modified: code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
===================================================================
--- code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc	2010-05-20 18:30:38 UTC (rev 6942)
+++ code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc	2010-05-20 19:04:46 UTC (rev 6943)
@@ -48,7 +48,7 @@
         this->reloadTime_ = 0.20f;
         this->bParallelReload_ = false;
         this->damage_ = 100;
-        this->speed_ = 50;
+        this->speed_ = 1;
 
         this->setMunitionName("LaserMunition");
         // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
@@ -66,10 +66,11 @@
 		rocket->setOrientation(this->getMuzzleOrientation());
 		Vector3 pos = this->getMuzzlePosition() + (this->getMuzzleOrientation()* Vector3(-2, -3, -2));
         rocket->setPosition(pos);
+		rocket->setAcceleration(20*rocket->getOrientation() * WorldEntity::FRONT);
 		rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
 		rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
 		rocket->setDamage(this->damage_);
-		WorldEntity* pawnn=(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getTarget());
+		WorldEntity* pawnn=this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getTarget();
 		if (pawnn) {
 		con->setTarget(pawnn);
 		}




More information about the Orxonox-commit mailing list