Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2011, 8:36:41 PM (13 years ago)
Author:
jo
Message:

Merged Formation branch. There are still some bugs (just have a look at the tutorial level)

Location:
code/branches/presentation2011
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2011

  • code/branches/presentation2011/src/orxonox/controllers/FormationController.cc

    r8991 r8992  
    4040#include "gametypes/TeamDeathmatch.h"
    4141#include "gametypes/Dynamicmatch.h"
    42 //#include "gametypes/Mission.h" TODO: include mission after merging
     42#include "gametypes/Mission.h" TODO: include mission after merging
    4343#include "gametypes/Gametype.h"
    4444#include "controllers/WaypointPatrolController.h"
     
    962962        }
    963963
    964         /*Mission* miss = orxonox_cast<Mission*>(gametype); //NEW
     964        Mission* miss = orxonox_cast<Mission*>(gametype);
    965965        if (miss)
    966966        {
     
    970970            if (entity2->getPlayer())
    971971                team2 = miss->getTeam(entity2->getPlayer());
    972         }*/
     972        }
    973973
    974974        TeamBaseMatchBase* base = 0;
     
    10391039    }
    10401040
     1041    void FormationController::absoluteMoveToPosition(const Vector3& target)
     1042    {
     1043        float minDistance = 40.0f;
     1044        if (!this->getControllableEntity())
     1045            return;
     1046
     1047        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
     1048        float distance = (target - this->getControllableEntity()->getPosition()).length();
     1049
     1050            if (this->target_ || distance > minDistance)
     1051            {
     1052                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
     1053                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
     1054                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
     1055                this->getControllableEntity()->moveFrontBack(SPEED_FREE);
     1056            }
     1057
     1058
     1059        if (distance < minDistance)
     1060        {
     1061            this->positionReached();
     1062        }
     1063    }
     1064
    10411065}
Note: See TracChangeset for help on using the changeset viewer.