Improve movement, crouching, and add M2 animation

Movement:
- Fix speed controls: Shift=sprint (28), normal run (14), Ctrl=walk (5)
- Reduce character height for doorway clearance (eye height 1.2)
- Add working crouch (C or X key) with smooth transition (eye height 0.6)
- Jump to stand up from crouch

M2 Animation:
- Add animation time tracking per M2 instance
- Add procedural swaying animation in vertex shader
- Update animation each frame for vegetation movement
This commit is contained in:
Kelsi 2026-02-02 23:10:19 -08:00
parent 4287878a73
commit 76a16a214e
5 changed files with 63 additions and 17 deletions

View file

@ -57,6 +57,11 @@ struct M2Instance {
float scale;
glm::mat4 modelMatrix;
// Animation state
float animTime = 0.0f; // Current animation time
float animSpeed = 1.0f; // Animation playback speed
uint32_t animId = 0; // Current animation sequence
void updateModelMatrix();
};
@ -100,6 +105,12 @@ public:
uint32_t createInstanceWithMatrix(uint32_t modelId, const glm::mat4& modelMatrix,
const glm::vec3& position);
/**
* Update animation state for all instances
* @param deltaTime Time since last frame
*/
void update(float deltaTime);
/**
* Render all visible instances
*/