#pragma once #include #include "utils/math.hpp" struct PlayerInputState { bool forward{}; bool left{}; bool backward{}; bool right{}; }; struct PlayerCollision { Vec3 pos{}; Vec3 vel{}; bool hit_x{}; bool hit_y{}; bool hit_z{}; }; struct Player { public: Player(); Vec3 pos{}; Vec3 prev_pos{}; Vec3 vel{}; uint32_t yaw{}; int32_t pitch{}; float radius{0.5f}; float height{1.5f}; bool on_ground{false}; bool jump_pressed{false}; void computeMovement(const PlayerInputState& input); void addLook(int dx, int dy); void applyCollision(const PlayerCollision& col); Vec3 interpolatedPos(double alpha) const; double getAccX() const { return acc_x; } double getAccZ() const { return acc_z; } void respawn(const Vec3& spawn_pos); private: double acc_x{}; double acc_z{}; };