diff options
| author | Mel <einebeere@gmail.com> | 2024-02-04 21:20:52 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-02-04 21:20:52 +0100 |
| commit | e2e52b7069d2eeed18e935616d72af5774b14a97 (patch) | |
| tree | 77fe19692cbc7d00dcebc51752c032867a33a2cd /src/Entities/Player.hpp | |
| parent | 44b87e9751f054ed5406042d69bbc130331d660e (diff) | |
| download | meowcraft-e2e52b7069d2eeed18e935616d72af5774b14a97.tar.zst meowcraft-e2e52b7069d2eeed18e935616d72af5774b14a97.zip | |
Toggle between movement modes (Walking, Flying, NoClip)
Diffstat (limited to 'src/Entities/Player.hpp')
| -rw-r--r-- | src/Entities/Player.hpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Entities/Player.hpp b/src/Entities/Player.hpp index f6c1f9a..c8a1c1f 100644 --- a/src/Entities/Player.hpp +++ b/src/Entities/Player.hpp @@ -29,6 +29,8 @@ private: Bool positive, negative; }; + Bool can_collide() const; + struct ProcessCollisionsResult { Position::World position; Vector<3, BlockedAxis> blocked_axes; @@ -39,6 +41,7 @@ private: 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); + Vec3 noclip_velocity(GFX::Window& window, const Time& time, Vec3 input_direction); void actions(GFX::Window& window, World::World& world); @@ -53,8 +56,17 @@ private: // Returns position of the center of the bottom face of `box`. static Position::World position_for_bounding_box(AABB box); + enum class MovementMode { + // Gravity, collision, and normal movement + Walking, + // Collisions, but no gravity, and normal movement + Flying, + // No collisions, no gravity, movement in the facing direction + NoClip, + }; + + MovementMode m_movement = MovementMode::Walking; Bool m_on_ground = false; - Bool m_flying = false; Vec3 m_velocity{}; Transform m_transform; |
