25 #include "glm/vec3.hpp" 26 #include "glm/gtc/type_ptr.hpp" 70 moveTo(creature, area, x, y, 1.0f, dt);
77 glm::vec2 origin(oX, oY);
78 glm::vec2 diff = glm::vec2(x, y) - origin;
79 float dist = glm::length(diff);
90 glm::vec2 dir = glm::normalize(diff);
91 float newX = origin.x + moveRate * dir.x * dt;
92 float newY = origin.y + moveRate * dir.y * dt;
95 bool haveMovement = (z !=
FLT_MIN) &&
97 glm::vec3(newX, newY, z + 0.1f));
A creature in a Star Wars: Knights of the Old Republic area.
ActionType getType() const
static void executeFollowLeader(Creature &creature, Area &area, const Action &action, float dt)
static void executeMoveToPoint(Creature &creature, Area &area, const Action &action, float dt)
const Action * peekAction() const
Creature action executor for Star Wars: Knights of the Old Republic.
bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const
Module * _module
The module this area is in.
static bool moveTo(Creature &creature, Area &area, float x, float y, float range, float dt)
Move the creature towards a point.
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
An area in Star Wars: Knights of the Old Republic, holding all objects and rooms within, as well as general area properties like the current background music and ambient sounds.
void warning(const char *s,...)
The context holding a Star Wars: Knights of the Old Republic area.
float getWalkRate() const
void getPoint(float &x, float &y, float &z) const
const Action * dequeueAction()
static const float kWalkDistance
void playDefaultAnimation()
void makeLookAt(float x, float y)
float evaluateElevation(Object *object, float x, float y, bool doHighlight=true)
void setPosition(float x, float y, float z)
Set the creature's position.
The context needed to run a Star Wars: Knights of the Old Republic module.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
static void executeActions(Creature &creature, Area &area, float dt)
Creature * getPC()
Return the currently playing PC.