Skip to content

Commit

Permalink
Fixed player position logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dmin12 committed Jun 4, 2024
1 parent 1685d23 commit 7bdbc37
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 7bdbc37

Please sign in to comment.