-glm::mat4 FPSController::Transform() const {
- return glm::translate(position) * glm::eulerAngleYX(yaw, pitch);
+void FPSController::Pitch(float p) noexcept {
+ pitch = p;
+ if (pitch > PI / 2) {
+ pitch = PI / 2;
+ } else if (pitch < -PI / 2) {
+ pitch = -PI / 2;
+ }
+}
+
+void FPSController::RotatePitch(float delta) noexcept {
+ Pitch(pitch + delta);
+}
+
+void FPSController::Yaw(float y) noexcept {
+ yaw = y;
+ if (yaw > PI) {
+ yaw -= PI * 2;
+ } else if (yaw < -PI) {
+ yaw += PI * 2;
+ }
+}
+
+void FPSController::RotateYaw(float delta) noexcept {
+ Yaw(yaw + delta);
+}
+
+
+void FPSController::Update(int dt) noexcept {
+ entity.Rotation(glm::eulerAngleYX(yaw, pitch));
+ entity.Velocity(glm::rotateY(velocity, yaw));