[Orxonox-commit 1340] r6058 - in code/branches/steering/src/orxonox: controllers graphics weaponsystem

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Nov 13 12:06:22 CET 2009


Author: rgrieder
Date: 2009-11-13 12:06:22 +0100 (Fri, 13 Nov 2009)
New Revision: 6058

Modified:
   code/branches/steering/src/orxonox/controllers/NewHumanController.cc
   code/branches/steering/src/orxonox/graphics/Camera.h
   code/branches/steering/src/orxonox/weaponsystem/WeaponMode.cc
Log:
Found the firing direction bug: "Fixed goes first" we were told a few weeks ago in a lecture about spatial coordinates.
Here the problem was a quaternion multiplication.

Modified: code/branches/steering/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/steering/src/orxonox/controllers/NewHumanController.cc	2009-11-13 10:31:30 UTC (rev 6057)
+++ code/branches/steering/src/orxonox/controllers/NewHumanController.cc	2009-11-13 11:06:22 UTC (rev 6058)
@@ -58,7 +58,7 @@
         crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
         crossHairOverlay_->show();
 
-        // HACK: Define which objects are targettable when considering the creator of an orxonox::Model
+        // HACK: Define which objects are targetable when considering the creator of an orxonox::Model
         this->targetMask_.exclude(ClassByString("BaseObject"));
         this->targetMask_.include(ClassByString("WorldEntity"));
         this->targetMask_.exclude(ClassByString("Projectile"));
@@ -120,7 +120,7 @@
 
         //std::cout << "X: " << static_cast<float>(this->currentYaw_)/2*-1+.5 << "  Y: " << static_cast<float>(this->currentPitch_)/2*-1+.5 << endl;
 
-        Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5, static_cast<float>(this->currentPitch_)/2*-1+.5);
+        Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5, static_cast<float>(this->currentPitch_)/2*-1+.5);
 
         rsq->setRay(mouseRay);
         rsq->setSortByDistance(true);
@@ -169,8 +169,8 @@
             std::cout << "distance: " << obj.distance << "  name: " << obj.movable->getName() << endl;
         }
 */
-        return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z * 100);
-        //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getCamera()->getCamera()->getOrientation() * Vector3::NEGATIVE_UNIT_Z);
+        return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z * 800);
+        //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getCamera()->getOgreCamera()->getOrientation() * Vector3::NEGATIVE_UNIT_Z);
     }
 
     void NewHumanController::yaw(const Vector2& value)

Modified: code/branches/steering/src/orxonox/graphics/Camera.h
===================================================================
--- code/branches/steering/src/orxonox/graphics/Camera.h	2009-11-13 10:31:30 UTC (rev 6057)
+++ code/branches/steering/src/orxonox/graphics/Camera.h	2009-11-13 11:06:22 UTC (rev 6058)
@@ -51,7 +51,7 @@
             void requestFocus();
             void releaseFocus();
 
-            inline Ogre::Camera* getCamera()
+            inline Ogre::Camera* getOgreCamera()
                { return this->camera_; }
 
             inline bool hasFocus()

Modified: code/branches/steering/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/branches/steering/src/orxonox/weaponsystem/WeaponMode.cc	2009-11-13 10:31:30 UTC (rev 6057)
+++ code/branches/steering/src/orxonox/weaponsystem/WeaponMode.cc	2009-11-13 11:06:22 UTC (rev 6058)
@@ -205,7 +205,7 @@
             if (controller->canFindTarget())
             {
                 Vector3 muzzleDirection(controller->getTarget() - this->muzzlePosition_);
-                this->muzzleOrientation_ = this->weapon_->getWorldOrientation() * (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection);
+                this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
             }
             else
                 this->muzzleOrientation_ = this->weapon_->getWorldOrientation();




More information about the Orxonox-commit mailing list