summary refs log tree commit diff
path: root/src/Entities/Player.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-02-01 23:56:57 +0100
committerMel <einebeere@gmail.com>2024-02-01 23:56:57 +0100
commit7b061aee2b4c15d242bb9f18101d6b9ea776c5cd (patch)
tree66ef0166efb36146a58075e2e21e8c1c36fbd927 /src/Entities/Player.hpp
parent7b107078a2a3b9f62a076f91e873f5ad0597d167 (diff)
downloadmeowcraft-7b061aee2b4c15d242bb9f18101d6b9ea776c5cd.tar.zst
meowcraft-7b061aee2b4c15d242bb9f18101d6b9ea776c5cd.zip
Walking movement
Diffstat (limited to 'src/Entities/Player.hpp')
-rw-r--r--src/Entities/Player.hpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/Entities/Player.hpp b/src/Entities/Player.hpp
index 95e3d64..5d70559 100644
--- a/src/Entities/Player.hpp
+++ b/src/Entities/Player.hpp
@@ -25,16 +25,35 @@ public:
     AABB bounds() const;
 
 private:
-    static Position::World process_collisions(World::World& world, Position::World from, Position::World to);
+    struct BlockedAxis {
+        Bool positive, negative;
+    };
+
+    struct ProcessCollisionsResult {
+        Position::World position;
+        Vector<3, BlockedAxis> blocked_axes;
+    };
+    static ProcessCollisionsResult process_collisions(World::World& world, Position::World from, Position::World to);
     static std::vector<AABB> terrain_collision_domain(Position::World from, Position::World to, World::World& world);
 
+    Position::World movement(GFX::Window& window, const Time& time, Vec3 input_direction);
+    Vec3 walking_velocity(GFX::Window& window, const Time& time, Vec3 input_direction);
+    Vec3 flying_velocity(GFX::Window& window, const Time& time, Vec3 input_direction);
+
     void update_camera_position(GFX::Camera& camera);
 
+    static Vec3 directional_input(GFX::Window& window);
+    static Rotation rotational_input(GFX::Window& window);
+
     // Creates a bounding box where `position` is at the center of the bottom face.
     static AABB bounding_box_for_position(Position::World position);
     // Returns position of the center of the bottom face of `box`.
     static Position::World position_for_bounding_box(AABB box);
 
+    Bool m_on_ground = false;
+    Bool m_flying = false;
+
+    Vec3 m_velocity{};
     Transform m_transform;
     static inline AABB s_bounds{{0.35, 1.8, 0.35}};
 };