feat: add moving platform support + fix jolt

This commit is contained in:
2026-10-18 13:34:30 +02:00
parent 65a7310b56
commit 7223e9ce07
15 changed files with 291 additions and 34 deletions
@@ -1,6 +1,8 @@
#ifndef LIGHTKEEPER_FIRSTPERSONCONTROLLER_H
#define LIGHTKEEPER_FIRSTPERSONCONTROLLER_H
#include <optional>
#include <glm/glm.hpp>
#include <destrum/Input/InputManager.h>
#include <destrum/ObjectModel/Component.h>
@@ -45,7 +47,12 @@ public:
void SetPossessed(bool possessed);
private:
[[nodiscard]] bool CheckGrounded() const;
struct GroundContact {
glm::vec3 normal;
glm::vec3 velocity;
};
[[nodiscard]] std::optional<GroundContact> FindGround() const;
[[nodiscard]] glm::vec3 GetWishDirection() const;
[[nodiscard]] Interactable* FindFocusedInteractable() const;
@@ -67,11 +74,14 @@ private:
float m_CoyoteTime{0.1f};
float m_JumpBufferTime{0.12f};
float m_InteractDistance{3.0f};
float m_MaxSlopeAngle{glm::radians(50.0f)};
float m_GroundStickSpeed{2.0f};
Interactable* m_FocusedInteractable{nullptr};
bool m_Possessed{false};
bool m_Grounded{false};
glm::vec3 m_GroundNormal{0.0f, 1.0f, 0.0f};
bool m_JumpHeld{false};
float m_CoyoteTimer{0.0f};
float m_JumpBufferTimer{0.0f};