#include <math.h>
#include <assert.h>
-PathWalker::PathWalker(const Path* path, bool running) :
- path(path),
- running(running),
- current_node_nr(0),
- next_node_nr(0),
- stop_at_node_nr(running?-1:0),
+PathWalker::PathWalker(const Path* path_, bool running_) :
+ path(path_),
+ running(running_),
+ current_node_nr(0),
+ next_node_nr(0),
+ stop_at_node_nr(running?-1:0),
node_time(0),
node_mult(),
walking_speed(1.0)
}
}
- const Path::Node* next_node = & (path->nodes[next_node_nr]);
node_time += elapsed_time * node_mult;
+ return get_pos();
+}
+
+Vector
+PathWalker::get_pos()
+{
+ const Path::Node* current_node = & (path->nodes[current_node_nr]);
+ const Path::Node* next_node = & (path->nodes[next_node_nr]);
Vector new_pos = current_node->position +
(next_node->position - current_node->position) * node_time;