mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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:
parent
4287878a73
commit
76a16a214e
5 changed files with 63 additions and 17 deletions
|
|
@ -85,7 +85,9 @@ private:
|
|||
// Gravity / grounding
|
||||
float verticalVelocity = 0.0f;
|
||||
bool grounded = false;
|
||||
float eyeHeight = 1.8f; // WoW human eye height (~2 yard tall character)
|
||||
static constexpr float STAND_EYE_HEIGHT = 1.2f; // Standing eye height
|
||||
static constexpr float CROUCH_EYE_HEIGHT = 0.6f; // Crouching eye height
|
||||
float eyeHeight = STAND_EYE_HEIGHT;
|
||||
float lastGroundZ = 0.0f; // Last known ground height (fallback when no terrain)
|
||||
static constexpr float GRAVITY = -30.0f;
|
||||
static constexpr float JUMP_VELOCITY = 15.0f;
|
||||
|
|
@ -115,11 +117,12 @@ private:
|
|||
// Movement callback
|
||||
MovementCallback movementCallback;
|
||||
|
||||
// Movement speeds (scaled up for better feel)
|
||||
// Movement speeds
|
||||
bool useWoWSpeed = false;
|
||||
static constexpr float WOW_RUN_SPEED = 14.0f; // Double base WoW speed for responsiveness
|
||||
static constexpr float WOW_WALK_SPEED = 5.0f; // Walk (hold Shift)
|
||||
static constexpr float WOW_BACK_SPEED = 9.0f; // Backpedal
|
||||
static constexpr float WOW_RUN_SPEED = 14.0f; // Normal run (WASD)
|
||||
static constexpr float WOW_SPRINT_SPEED = 28.0f; // Sprint (hold Shift)
|
||||
static constexpr float WOW_WALK_SPEED = 5.0f; // Walk (hold Ctrl)
|
||||
static constexpr float WOW_BACK_SPEED = 9.0f; // Backpedal
|
||||
static constexpr float WOW_GRAVITY = -19.29f;
|
||||
static constexpr float WOW_JUMP_VELOCITY = 7.96f;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue