From 6efda6122d32773fa72bc142375b5a2468f5d6ca Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sat, 16 Dec 2023 16:21:25 -0500 Subject: [PATCH] LETS TRY WITHOUT DAS JOOMP --- SQCSim-common/player.cpp | 53 ++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/SQCSim-common/player.cpp b/SQCSim-common/player.cpp index 1ad5fff..90191a9 100644 --- a/SQCSim-common/player.cpp +++ b/SQCSim-common/player.cpp @@ -123,15 +123,7 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi bt1 = world->BlockAt(GetPosition().x + input.x, GetPosition().y, GetPosition().z); bt2 = world->BlockAt(GetPosition().x + input.x, GetPosition().y - 0.9f, GetPosition().z); bt3 = world->BlockAt(GetPosition().x + input.x, GetPosition().y - 1.7f, GetPosition().z); - if (bt1 == BTYPE_AIR && bt2 != BTYPE_AIR && bt3 != BTYPE_AIR) { - if (input.x > 0) - input.x = m_velocity.x = 0.5f; - else - input.x = m_velocity.x = -0.5f; - m_velocity.y = 0.3; - m_velocity.z *= .5f; - } - else if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { + if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { input.x = m_velocity.x = 0; m_velocity.z *= .5f; } @@ -139,19 +131,44 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi bt1 = world->BlockAt(GetPosition().x, GetPosition().y, GetPosition().z + input.z); bt2 = world->BlockAt(GetPosition().x, GetPosition().y - 0.9f, GetPosition().z + input.z); bt3 = world->BlockAt(GetPosition().x, GetPosition().y - 1.7f, GetPosition().z + input.z); - if (bt1 == BTYPE_AIR && bt2 != BTYPE_AIR && bt3 != BTYPE_AIR) { - if (input.z > 0) - input.z = m_velocity.z = 0.5f; - else - input.z = m_velocity.z = -0.5f; - m_velocity.y = 0.3; - m_velocity.x *= .5f; - } - else if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { + if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { input.z = m_velocity.z = 0; m_velocity.x *= .5f; } + + //bt1 = world->BlockAt(GetPosition().x + input.x, GetPosition().y, GetPosition().z); + //bt2 = world->BlockAt(GetPosition().x + input.x, GetPosition().y - 0.9f, GetPosition().z); + //bt3 = world->BlockAt(GetPosition().x + input.x, GetPosition().y - 1.7f, GetPosition().z); + //if (bt1 == BTYPE_AIR && bt2 != BTYPE_AIR && bt3 != BTYPE_AIR) { + // if (input.x > 0) + // input.x = m_velocity.x = 0.5f; + // else + // input.x = m_velocity.x = -0.5f; + // m_velocity.y = 0.3; + // m_velocity.z *= .5f; + //} + //else if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { + // input.x = m_velocity.x = 0; + // m_velocity.z *= .5f; + //} + + //bt1 = world->BlockAt(GetPosition().x, GetPosition().y, GetPosition().z + input.z); + //bt2 = world->BlockAt(GetPosition().x, GetPosition().y - 0.9f, GetPosition().z + input.z); + //bt3 = world->BlockAt(GetPosition().x, GetPosition().y - 1.7f, GetPosition().z + input.z); + //if (bt1 == BTYPE_AIR && bt2 != BTYPE_AIR && bt3 != BTYPE_AIR) { + // if (input.z > 0) + // input.z = m_velocity.z = 0.5f; + // else + // input.z = m_velocity.z = -0.5f; + // m_velocity.y = 0.3; + // m_velocity.x *= .5f; + //} + //else if (bt1 != BTYPE_AIR || bt2 != BTYPE_AIR || bt3 != BTYPE_AIR) { + // input.z = m_velocity.z = 0; + // m_velocity.x *= .5f; + //} + /* Fin gestion de collisions */ /* Gestion de la friction */