mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
physics: add server swim-back speed override to CameraController
Backward swimming was using 50% of forward swim speed as a hardcoded fallback. Wire up the server-authoritative swim back speed so Warlock Dark Pact, buffs, and server-forced speed changes all apply correctly when swimming backward. - game_handler.hpp: add getServerSwimBackSpeed() accessor - camera_controller.hpp: add swimBackSpeedOverride_ field + setter - camera_controller.cpp: apply swimBackSpeedOverride_ when player swims backward without forward input; fall back to 50% of swim speed - application.cpp: sync swim back speed each frame
This commit is contained in:
parent
23293d6453
commit
a33f635490
4 changed files with 11 additions and 1 deletions
|
|
@ -537,6 +537,10 @@ void CameraController::update(float deltaTime) {
|
|||
// Use character's facing direction for strafe, not camera's right vector
|
||||
glm::vec3 swimRight = right; // Character's right (horizontal facing), not camera's
|
||||
|
||||
float swimBackSpeed = (swimBackSpeedOverride_ > 0.0f && swimBackSpeedOverride_ < 100.0f
|
||||
&& !std::isnan(swimBackSpeedOverride_))
|
||||
? swimBackSpeedOverride_ : swimSpeed * 0.5f;
|
||||
|
||||
glm::vec3 swimMove(0.0f);
|
||||
if (nowForward) swimMove += swimForward;
|
||||
if (nowBackward) swimMove -= swimForward;
|
||||
|
|
@ -545,7 +549,9 @@ void CameraController::update(float deltaTime) {
|
|||
|
||||
if (glm::length(swimMove) > 0.001f) {
|
||||
swimMove = glm::normalize(swimMove);
|
||||
targetPos += swimMove * swimSpeed * physicsDeltaTime;
|
||||
// Use backward swim speed when moving backwards only (not when combining with strafe)
|
||||
float applySpeed = (nowBackward && !nowForward) ? swimBackSpeed : swimSpeed;
|
||||
targetPos += swimMove * applySpeed * physicsDeltaTime;
|
||||
}
|
||||
|
||||
// Spacebar = swim up (continuous, not a jump)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue