1 #ifndef BLANK_APP_FPSCONTROLLER_HPP_
2 #define BLANK_APP_FPSCONTROLLER_HPP_
4 #include "../model/geometry.hpp"
5 #include "../world/Entity.hpp"
12 /// Sets entity rotation and velocity according to stored velocity
13 /// and pitch/yaw components.
14 /// Rotation is applied in yaw,pitch order (YX). Velocity is relative
15 /// to yaw only (Y axis).
19 explicit FPSController(Entity &) noexcept;
21 /// get position and face direction of controlled entity
22 Ray Aim() const noexcept { return entity.Aim(entity.ChunkCoords()); }
24 /// velocity, relative to heading (yaw only)
25 const glm::vec3 &Velocity() const noexcept { return velocity; }
26 void Velocity(const glm::vec3 &vel) noexcept { velocity = vel; }
28 // all angles in radians (full circle = 2π)
29 float Pitch() const noexcept { return pitch; }
30 void Pitch(float p) noexcept;
31 void RotatePitch(float delta) noexcept;
32 float Yaw() const noexcept { return yaw; }
33 void Yaw(float y) noexcept;
34 void RotateYaw(float delta) noexcept;
36 void Update(int dt) noexcept;