mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add property-based mount animation discovery and procedural lean
Mount Animation System: - Property-based jump animation discovery using sequence metadata - Chain linkage scoring (nextAnimation/aliasNext) for accurate detection - Correct loop detection: flags & 0x01 == 0 means looping - Avoids brake/stop animations via blendTime penalties - Works on any mount model without hardcoded animation IDs Mount Physics: - Physics-based jump height: vz = sqrt(2 * g * h) - Configurable MOUNT_JUMP_HEIGHT constant (1.0m default) - Procedural lean into turns for ground mounts - Smooth roll based on turn rate (±14° max, 6x/sec blend) Audio Improvements: - State-machine driven mount sounds (jump, land, rear-up) - Semantic sound methods (no animation ID dependencies) - Debug logging for missing sound files Bug Fixes: - Fixed mount animation sequencing (JumpStart → JumpLoop → JumpEnd) - Fixed animation loop flag interpretation (0x20 vs 0x21) - Rider bone attachment working correctly during all mount actions
This commit is contained in:
parent
3c783d1845
commit
c623fcef51
16 changed files with 1083 additions and 145 deletions
|
|
@ -67,6 +67,7 @@ public:
|
|||
bool isGrounded() const { return grounded; }
|
||||
bool isJumping() const { return !grounded && verticalVelocity > 0.0f; }
|
||||
bool isFalling() const { return !grounded && verticalVelocity <= 0.0f; }
|
||||
bool isJumpKeyPressed() const { return jumpBufferTimer > 0.0f; }
|
||||
bool isSprinting() const;
|
||||
bool isMovingForward() const { return moveForwardActive; }
|
||||
bool isMovingBackward() const { return moveBackwardActive; }
|
||||
|
|
@ -92,6 +93,9 @@ public:
|
|||
void setFacingYaw(float yaw) { facingYaw = yaw; } // For taxi/scripted movement
|
||||
void clearMovementInputs();
|
||||
|
||||
// Trigger mount jump (applies vertical velocity for physics hop)
|
||||
void triggerMountJump();
|
||||
|
||||
// For first-person player hiding
|
||||
void setCharacterRenderer(class CharacterRenderer* cr, uint32_t playerId) {
|
||||
characterRenderer = cr;
|
||||
|
|
@ -168,6 +172,16 @@ private:
|
|||
std::optional<float> cachedCamWmoFloor;
|
||||
bool hasCachedCamFloor = false;
|
||||
|
||||
// Cached floor height queries (update every 5 frames or 2 unit movement)
|
||||
glm::vec3 lastFloorQueryPos = glm::vec3(0.0f);
|
||||
std::optional<float> cachedFloorHeight;
|
||||
int floorQueryFrameCounter = 0;
|
||||
static constexpr float FLOOR_QUERY_DISTANCE_THRESHOLD = 2.0f; // Increased from 1.0
|
||||
static constexpr int FLOOR_QUERY_FRAME_INTERVAL = 5; // Increased from 3
|
||||
|
||||
// Helper to get cached floor height (reduces expensive queries)
|
||||
std::optional<float> getCachedFloorHeight(float x, float y, float z);
|
||||
|
||||
// Swimming
|
||||
bool swimming = false;
|
||||
bool wasSwimming = false;
|
||||
|
|
@ -212,6 +226,13 @@ private:
|
|||
static constexpr float WOW_TURN_SPEED = 180.0f; // Keyboard turn deg/sec
|
||||
static constexpr float WOW_GRAVITY = -19.29f;
|
||||
static constexpr float WOW_JUMP_VELOCITY = 7.96f;
|
||||
static constexpr float MOUNT_GRAVITY = -18.0f; // Snappy WoW-feel jump
|
||||
static constexpr float MOUNT_JUMP_HEIGHT = 1.0f; // Desired jump height in meters
|
||||
|
||||
// Computed jump velocity using vz = sqrt(2 * g * h)
|
||||
static inline float getMountJumpVelocity() {
|
||||
return std::sqrt(2.0f * std::abs(MOUNT_GRAVITY) * MOUNT_JUMP_HEIGHT);
|
||||
}
|
||||
|
||||
// Server-driven run speed override (0 = use default WOW_RUN_SPEED)
|
||||
float runSpeedOverride_ = 0.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue