SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
SelectionSeek.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "Steering.h"
7 
8 namespace ai {
9 namespace movement {
10 
15 public:
16  STEERING_FACTORY(SelectionSeek)
17 
18  explicit SelectionSeek(const std::string&) :
20  }
21 
22  virtual MoveVector execute (const AIPtr& ai, float speed) const override {
23  const glm::vec3& target = getSelectionTarget(ai, 0);
24  if (isInfinite(target)) {
25  const MoveVector d(target, 0.0);
26  }
27  const glm::vec3& v = glm::normalize(target - ai->getCharacter()->getPosition());
28  const float orientation = angle(v);
29  const MoveVector d(v * speed, orientation);
30  return d;
31  }
32 };
33 
34 }
35 }
IFilter steering interface
Definition: Steering.h:62
Definition: MoveVector.h:10
Defines some basic movement algorithms like Wandering, Seeking and Fleeing.
Seeks the current IFilter selection from the given ICharacter.
Definition: SelectionSeek.h:14
virtual MoveVector execute(const AIPtr &ai, float speed) const override
Calculates the MoveVector.
Definition: SelectionSeek.h:22