[Orxonox-commit 2234] r6950 - in code/branches/rocket/src/modules/weapons: . weaponmodes

scheusso at orxonox.net scheusso at orxonox.net
Fri May 21 09:40:15 CEST 2010


Author: scheusso
Date: 2010-05-21 09:40:14 +0200 (Fri, 21 May 2010)
New Revision: 6950

Modified:
   code/branches/rocket/src/modules/weapons/RocketController.cc
   code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
Log:
steering of the rocket now working, but oscilating
control parameters need adjustment


Modified: code/branches/rocket/src/modules/weapons/RocketController.cc
===================================================================
--- code/branches/rocket/src/modules/weapons/RocketController.cc	2010-05-21 07:36:01 UTC (rev 6949)
+++ code/branches/rocket/src/modules/weapons/RocketController.cc	2010-05-21 07:40:14 UTC (rev 6950)
@@ -81,7 +81,7 @@
 
 	void RocketController::setTargetPosition() {
 		//this->targetPosition_=this->target_->getWorldPosition();
-		this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getPosition(), this->target_->getVelocity());
+		this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
 	}
 	void RocketController::moveToTargetPosition() {
 		this->moveToPosition(this->targetPosition_);
@@ -101,11 +101,7 @@
 	   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)<<target-this->getControllableEntity()->getPosition() << endl;
 	   //COUT(0)<<"\n 2D view: ";
 	  /* COUT(0)<<this->getControllableEntity()->getPosition().x;
 	   COUT(0)<<" ";
@@ -116,11 +112,13 @@
         Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
         float distance = (target - this->getControllableEntity()->getPosition()).length();
 		//Vector3D diff =target-this->rocket->getPosition();
-		//COUT(0)<<coord.x;
+		COUT(0) << "viewdirection: "<< coord << endl;
 		//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()->rotateYaw(-0.8f*sgn(coord.x)*coord.x*coord.x);
+        this->getControllableEntity()->rotatePitch(0.8f*sgn(coord.y)*coord.y*coord.y);
+//         this->getControllableEntity()->rotateYaw(10);
+//         this->getControllableEntity()->rotatePitch(0);
 		//this->getControllableEntity()->rotatePitch(rotation.getPitch().valueRadians());
 		//this->getControllableEntity()->rotateYaw(rotation.getYaw().valueRadians());
 		//this->getControllableEntity()->moveUpDown(coord.y);

Modified: code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
===================================================================
--- code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc	2010-05-21 07:36:01 UTC (rev 6949)
+++ code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc	2010-05-21 07:40:14 UTC (rev 6950)
@@ -48,7 +48,7 @@
         this->reloadTime_ = 0.20f;
         this->bParallelReload_ = false;
         this->damage_ = 100;
-        this->speed_ = 1;
+        this->speed_ = 100;
 
         this->setMunitionName("LaserMunition");
         // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
@@ -63,10 +63,11 @@
 		RocketController* con = new RocketController(this);
 		SimpleRocket* rocket = con->getRocket();
 		this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
-		rocket->setOrientation(this->getMuzzleOrientation());
-		Vector3 pos = this->getMuzzlePosition() + (this->getMuzzleOrientation()* Vector3(-2, -3, -2));
+// 		rocket->setOrientation(this->getMuzzleOrientation());
+        rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation());
+		Vector3 pos = this->getMuzzlePosition();
         rocket->setPosition(pos);
-		rocket->setAcceleration(20*rocket->getOrientation() * WorldEntity::FRONT);
+// 		rocket->setAcceleration(20*rocket->getOrientation() * WorldEntity::FRONT);
 		rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
 		rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
 		rocket->setDamage(this->damage_);




More information about the Orxonox-commit mailing list