mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
physics: implement Water Walk movement state tracking and surface clamping
SMSG_MOVE_WATER_WALK / SMSG_MOVE_LAND_WALK now correctly set/clear WATER_WALK (0x00008000) in movementInfo.flags, ensuring the flag is included in movement ACKs sent to the server. In CameraController, when waterWalkActive_ is set and the player is at or above the water surface (within 0.5 units), clamp them to the water surface and mark as grounded — preventing water entry and allowing them to walk across the water surface as the spell intends.
This commit is contained in:
parent
0b99cbafb2
commit
1853e8aa56
6 changed files with 20 additions and 3 deletions
|
|
@ -410,7 +410,14 @@ void CameraController::update(float deltaTime) {
|
|||
constexpr float MAX_SWIM_DEPTH_FROM_SURFACE = 12.0f;
|
||||
constexpr float MIN_SWIM_WATER_DEPTH = 1.0f;
|
||||
bool inWater = false;
|
||||
if (waterH && targetPos.z < *waterH) {
|
||||
// Water Walk: treat water surface as ground — player walks on top, not through.
|
||||
if (waterWalkActive_ && waterH && targetPos.z >= *waterH - 0.5f) {
|
||||
// Clamp to water surface so the player stands on it
|
||||
targetPos.z = *waterH;
|
||||
verticalVelocity = 0.0f;
|
||||
grounded = true;
|
||||
inWater = false;
|
||||
} else if (waterH && targetPos.z < *waterH) {
|
||||
std::optional<uint16_t> waterType;
|
||||
if (waterRenderer) {
|
||||
waterType = waterRenderer->getWaterTypeAt(targetPos.x, targetPos.y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue