From 7bdbc3722b5db0ca3923cbc0a7caf835c20a856e Mon Sep 17 00:00:00 2001 From: David Min Date: Mon, 3 Jun 2024 22:16:18 -0700 Subject: [PATCH] Fixed player position logic --- src/client/client.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index 645ac45f..e888094a 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -630,7 +630,8 @@ void Client::geometryPass() { if (this->session->getInfo().client_eid.has_value() && sharedObject->globalID == this->session->getInfo().client_eid.value()) { // TODO: Update the player eye level to an acceptable level - glm::vec3 pos = sharedObject->physics.getCenterPosition() - (sharedObject->physics.dimensions.y / 2.0f); + glm::vec3 pos = sharedObject->physics.getCenterPosition(); + pos.y -= (sharedObject->physics.dimensions.y / 2.0f); pos.y += PLAYER_EYE_LEVEL; cam->updatePos(pos); @@ -661,7 +662,9 @@ void Client::geometryPass() { if (!sharedObject->playerInfo->render) { break; } // dont render while invisible - auto player_pos = sharedObject->physics.getCenterPosition() - (sharedObject->physics.dimensions.y / 2.0f); + auto player_pos = sharedObject->physics.getCenterPosition(); + player_pos.y -= (sharedObject->physics.dimensions.y / 2.0f); + auto player_dir = sharedObject->physics.facing; if (player_dir == glm::vec3(0.0f)) {