From 89a1520d7c9cb29162175095af334e5c40de729a Mon Sep 17 00:00:00 2001 From: Pedro Gimeno Date: Wed, 26 Feb 2020 20:30:05 +0100 Subject: [PATCH] Change player position to be at the feet, rather than the head Note: This breaks the visualization of the other players (PlayerBox). --- client/source/world/ClientPlayer.cpp | 4 ++-- common/source/world/Player.cpp | 2 +- server/include/network/ServerCommandHandler.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/source/world/ClientPlayer.cpp b/client/source/world/ClientPlayer.cpp index e70a6f88..d2e7da65 100644 --- a/client/source/world/ClientPlayer.cpp +++ b/client/source/world/ClientPlayer.cpp @@ -40,7 +40,7 @@ ClientPlayer::ClientPlayer(gk::Camera &camera) : m_camera(camera) { // FIXME: Warning: Duplicated in ServerCommandHandler.hpp m_x = 14; m_y = 14; - m_z = 20; + m_z = 18; m_viewAngleH = -90.; m_viewAngleV = 0.01; @@ -118,7 +118,7 @@ void ClientPlayer::processInputs() { } void ClientPlayer::updatePosition(const ClientWorld &world) { - ClientChunk *chunk = (ClientChunk *)world.getChunkAtBlockPos(m_x, m_y, m_z - 0.2); + ClientChunk *chunk = (ClientChunk *)world.getChunkAtBlockPos(m_x, m_y, m_z); if (!Config::isFlyModeEnabled && chunk && chunk->isInitialized()) { m_velocity.z -= m_gravity; // Gravity diff --git a/common/source/world/Player.cpp b/common/source/world/Player.cpp index 1d87c8ba..4db73ec1 100644 --- a/common/source/world/Player.cpp +++ b/common/source/world/Player.cpp @@ -28,7 +28,7 @@ #include "Player.hpp" Player::Player() { - m_hitbox = gk::FloatBox{-0.2, -0.2, -1.8, 0.4, 0.4, 1.8}; + m_hitbox = gk::FloatBox{-0.3125, -0.3125, 0, 0.625, 0.625, 1.75}; } void Player::serialize(sf::Packet &packet) const { diff --git a/server/include/network/ServerCommandHandler.hpp b/server/include/network/ServerCommandHandler.hpp index 793d18b5..7fd20fb6 100644 --- a/server/include/network/ServerCommandHandler.hpp +++ b/server/include/network/ServerCommandHandler.hpp @@ -65,7 +65,7 @@ class ServerCommandHandler { Registry &m_registry; // FIXME: Warning: Duplicated in ClientPlayer.cpp - gk::Vector3 m_spawnPosition{14, 14, 20}; + gk::Vector3 m_spawnPosition{14, 14, 18}; }; #endif // SERVERCOMMANDHANDLER_HPP_