physics: sync server turn rate and fix SPLINE speed handlers

- Add getServerTurnRate() accessor and turnRateOverride_ field so the
  keyboard turn speed respects SMSG_FORCE_TURN_RATE_CHANGE from server
- Convert rad/s → deg/s before applying to camera yaw logic
- Fix SMSG_SPLINE_SET_RUN_BACK/SWIM/FLIGHT/FLIGHT_BACK/SWIM_BACK/WALK/
  TURN_RATE handlers: all previously discarded the value; now update the
  corresponding serverXxxSpeed_ / serverTurnRate_ field when GUID matches
  playerGuid (camera controller syncs these every frame)
This commit is contained in:
Kelsi 2026-03-10 14:18:25 -07:00
parent e2f65dfc59
commit a9ddfe70c2
5 changed files with 36 additions and 11 deletions

View file

@ -298,11 +298,16 @@ void CameraController::update(float deltaTime) {
nowStrafeRight = !movBlocked && (keyD || keyE);
}
// Keyboard turning updates camera yaw (character follows yaw in renderer)
// Keyboard turning updates camera yaw (character follows yaw in renderer).
// Use server turn rate (rad/s) when set; otherwise fall back to WOW_TURN_SPEED (deg/s).
const float activeTurnSpeedDeg = (turnRateOverride_ > 0.0f && turnRateOverride_ < 20.0f
&& !std::isnan(turnRateOverride_))
? glm::degrees(turnRateOverride_)
: WOW_TURN_SPEED;
if (nowTurnLeft && !nowTurnRight) {
yaw += WOW_TURN_SPEED * deltaTime;
yaw += activeTurnSpeedDeg * deltaTime;
} else if (nowTurnRight && !nowTurnLeft) {
yaw -= WOW_TURN_SPEED * deltaTime;
yaw -= activeTurnSpeedDeg * deltaTime;
}
if (nowTurnLeft || nowTurnRight) {
camera->setRotation(yaw, pitch);