-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFollow.cpp
33 lines (24 loc) · 856 Bytes
/
Follow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <vector>
#include "Mobile.hpp"
#include "Follow.hpp"
#include "Triple.hpp"
#include "Arrive.hpp"
#define DEBUG_FOLLOW
#ifdef DEBUG_FOLLOW
# include <iostream>
#endif
Follow::Follow(std::string name, Mobile *character, Mobile *target, double phantomOffset, double maxSpeed, double targetRadius, double slowRadius) :
DirectKinematicV(name),
character(character),
target(target),
marcus(Phantom()),
phantomOffset(phantomOffset),
arrive(new Arrive(name + "Arrive", character, &marcus, maxSpeed, targetRadius, slowRadius))
{}
Follow::~Follow() {
delete this->arrive;
}
std::vector<Triple> Follow::getVel(unsigned int ticks, unsigned int delta_ticks) {
marcus.pos = target->pos + target->orientation() * phantomOffset;
return (arrive->getVel(ticks, delta_ticks));
}