[Orxonox-commit 6140] r10798 - code/branches/AI_HS15/src/orxonox/controllers
gania at orxonox.net
gania at orxonox.net
Thu Nov 12 11:31:46 CET 2015
Author: gania
Date: 2015-11-12 11:31:46 +0100 (Thu, 12 Nov 2015)
New Revision: 10798
Modified:
code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
Log:
low on battery 2
Modified: code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc 2015-11-12 10:27:41 UTC (rev 10797)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc 2015-11-12 10:31:46 UTC (rev 10798)
@@ -138,7 +138,7 @@
bool bTargetIsLookingAtThis = (targetAngle/(diffLength*diffLength) < math::pi/8000000.0f);
float angleDiff = targetAngle - myAngle;
- //I am looking when my angle < pi/6
+
//if his angle is bigger than mine
if ( angleDiff > 0 )
{
@@ -175,7 +175,16 @@
//this has advantage
else
{
-
+ //if too close
+ if ( diffLength < 300 )
+ {
+ this->setTargetPosition( this->getControllableEntity()->getWorldPosition() );
+ }
+ //move closer
+ else
+ {
+ this->setTargetPosition( this->positionOfTarget_ - 0.6f*diffVector);
+ }
}
}
More information about the Orxonox-commit
mailing list