summaryrefslogtreecommitdiffstats
path: root/src/world/GameState.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-07-21 16:49:56 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-07-21 16:49:56 +0200
commit9e56348975dbdaf1cce9dd688129208a61fd4eb5 (patch)
tree5a44a37cf0243c1ced14c222f35983eaaaa0185b /src/world/GameState.cpp
parent2017-06-21 (diff)
downloadAltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar
AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.gz
AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.bz2
AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.lz
AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.xz
AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.tar.zst
AltCraft-9e56348975dbdaf1cce9dd688129208a61fd4eb5.zip
Diffstat (limited to '')
-rw-r--r--src/world/GameState.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/world/GameState.cpp b/src/world/GameState.cpp
index b484b06..79e2f1b 100644
--- a/src/world/GameState.cpp
+++ b/src/world/GameState.cpp
@@ -325,14 +325,6 @@ void GameState::HandleMovement(GameState::Direction direction, float deltaTime)
g_PlayerVelocityX = vel.x;
g_PlayerVelocityY = vel.y;
g_PlayerVelocityZ = vel.z;
-
- /*bool isCollides = world.isPlayerCollides(g_PlayerX, g_PlayerY, g_PlayerZ);
- if (isCollides) {
- SetPosition(previousPos);
- return;
- }
- auto updatePacket = std::make_shared<PacketPlayerPosition>(g_PlayerX, g_PlayerY, g_PlayerZ, true);
- nc->SendPacket(updatePacket);*/
}
void GameState::HandleRotation(double yaw, double pitch) {
@@ -349,7 +341,9 @@ void GameState::HandleRotation(double yaw, double pitch) {
}
glm::mat4 GameState::GetViewMatrix() {
- return glm::lookAt(this->Position(), this->Position() + this->Front, this->Up);
+ auto pos = this->Position();
+ pos.y+=1.62;
+ return glm::lookAt(pos, pos + this->Front, this->Up);
}
void GameState::updateCameraVectors() {
@@ -379,11 +373,11 @@ void GameState::SetPitch(float pitch) {
}
glm::vec3 GameState::Position() {
- return glm::vec3(g_PlayerX - 0.5, g_PlayerY + 1.12, g_PlayerZ - 0.5);
+ return glm::vec3(g_PlayerX, g_PlayerY, g_PlayerZ);
}
void GameState::SetPosition(glm::vec3 Position) {
- g_PlayerX = Position.x + 0.5;
- g_PlayerY = Position.y - 1.12;
- g_PlayerZ = Position.z + 0.5;
+ g_PlayerX = Position.x;
+ g_PlayerY = Position.y;
+ g_PlayerZ = Position.z;
}