[Orxonox-commit 2232] r6948 - code/branches/rocket/src/orxonox/controllers
scheusso at orxonox.net
scheusso at orxonox.net
Fri May 21 09:33:13 CEST 2010
Author: scheusso
Date: 2010-05-21 09:33:13 +0200 (Fri, 21 May 2010)
New Revision: 6948
Modified:
code/branches/rocket/src/orxonox/controllers/NewHumanController.cc
Log:
somes fixes/changes in NewHumanController
Modified: code/branches/rocket/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/rocket/src/orxonox/controllers/NewHumanController.cc 2010-05-21 06:36:32 UTC (rev 6947)
+++ code/branches/rocket/src/orxonox/controllers/NewHumanController.cc 2010-05-21 07:33:13 UTC (rev 6948)
@@ -358,14 +358,21 @@
Ogre::RaySceneQueryResult& result = rsq->execute();
Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
+ WorldEntity* myWe = static_cast<WorldEntity*>(this->getControllableEntity());
Ogre::RaySceneQueryResult::iterator itr;
for (itr = result.begin(); itr != result.end(); ++itr)
{
- if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 500)
+// CCOUT(0) << "testing object as target" << endl;
+ if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" /*&& itr->distance > 500*/)
{
// Try to cast the user pointer
WorldEntity* wePtr = dynamic_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny()));
+
+ // make sure we don't shoot ourselves
+ if( wePtr==myWe )
+ continue;
+
if (wePtr)
{
// go through all parents of object and look whether they are sightable or not
@@ -373,7 +380,7 @@
WorldEntity* parent = wePtr->getParent();
while (parent)
{
- if (this->targetMask_.isExcluded(parent->getIdentifier()))
+ if (this->targetMask_.isExcluded(parent->getIdentifier()) || parent==myWe)
{
parent = parent->getParent();
continue;
@@ -573,9 +580,9 @@
this->arrowsOverlay4_->hide();
}
}
-
+
-
+
}
More information about the Orxonox-commit
mailing list