-void FPSController::HandleKeyboard(const SDL_KeyboardEvent &event) {
- switch (event.keysym.sym) {
- case SDLK_w:
- front = event.state == SDL_PRESSED;
+void FPSController::Update(int dt) {
+ entity.Rotation(glm::eulerAngleYX(yaw, pitch));
+ entity.Velocity(glm::rotateY(velocity, yaw));
+}
+
+
+RandomWalk::RandomWalk(Entity &e)
+: entity(e)
+, time_left(0) {
+
+}
+
+
+void RandomWalk::Update(int dt) {
+ time_left -= dt;
+ if (time_left > 0) return;
+ time_left += 2500 + (rand() % 5000);
+
+ constexpr float move_vel = 0.0005f;
+
+ glm::vec3 new_vel = entity.Velocity();
+
+ switch (rand() % 9) {
+ case 0:
+ new_vel.x = -move_vel;