feat: add moving platform support + fix jolt
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#ifndef LIGHTKEEPER_MOVINGPLATFORM_H
|
||||
#define LIGHTKEEPER_MOVINGPLATFORM_H
|
||||
|
||||
#include <destrum/ObjectModel/Component.h>
|
||||
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
class MovingPlatform final : public Component {
|
||||
public:
|
||||
explicit MovingPlatform(GameObject& parent);
|
||||
|
||||
std::string GetTypeName() const override { return "MovingPlatform"; }
|
||||
|
||||
void Start() override;
|
||||
void Update(float dt) override;
|
||||
|
||||
nlohmann::json Serialize() const override;
|
||||
void Deserialize(const nlohmann::json& data) override;
|
||||
void ImGuiInspector() override;
|
||||
|
||||
void SetTravelOffset(const glm::vec3& offset) { m_TravelOffset = offset; }
|
||||
void SetTravelDuration(float seconds) { m_TravelDuration = seconds; }
|
||||
void SetPauseDuration(float seconds) { m_PauseDuration = seconds; }
|
||||
|
||||
private:
|
||||
[[nodiscard]] float GetTravelProgress() const;
|
||||
[[nodiscard]] glm::vec3 GetOffsetAt(float progress) const;
|
||||
|
||||
glm::vec3 m_TravelOffset{8.0f, 0.0f, 0.0f};
|
||||
float m_TravelDuration{4.0f};
|
||||
float m_PauseDuration{1.0f};
|
||||
|
||||
float m_ElapsedTime{0.0f};
|
||||
glm::vec3 m_StartPosition{0.0f};
|
||||
bool m_Started{false};
|
||||
};
|
||||
|
||||
#endif // LIGHTKEEPER_MOVINGPLATFORM_H
|
||||
Reference in New Issue
Block a user