From 8d5cdbdc7d7f09c4bb1f903b8e4975720b1caf34 Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Sat, 5 Jun 2021 09:53:22 +0700 Subject: [PATCH] Fix blaster bolts trajectory --- src/engine/game/combat/combat_projectiles.cpp | 4 ++-- src/engine/game/gui/chargen/portraitselect.cpp | 2 +- src/engine/game/object/area.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/game/combat/combat_projectiles.cpp b/src/engine/game/combat/combat_projectiles.cpp index e512a8c3..54f67bbc 100644 --- a/src/engine/game/combat/combat_projectiles.cpp +++ b/src/engine/game/combat/combat_projectiles.cpp @@ -54,7 +54,7 @@ void Combat::fireProjectile(const shared_ptr &attacker, const shared_p glm::vec3 projectilePos; shared_ptr bulletHook(weaponModel->model()->getNodeByName("bullethook")); if (bulletHook) { - projectilePos = weaponModel->absoluteTransform() * glm::vec4(bulletHook->restPosition(), 1.0f); + projectilePos = weaponModel->absoluteTransform() * bulletHook->absoluteTransform()[3]; } else { projectilePos = weaponModel->getOrigin(); } @@ -63,7 +63,7 @@ void Combat::fireProjectile(const shared_ptr &attacker, const shared_p glm::vec3 projectileTarget; shared_ptr impact(targetModel->model()->getNodeByName("impact")); if (impact) { - projectileTarget = targetModel->absoluteTransform() * glm::vec4(impact->restPosition(), 1.0f); + projectileTarget = targetModel->absoluteTransform() * impact->absoluteTransform()[3]; } else { projectileTarget = targetModel->getOrigin(); } diff --git a/src/engine/game/gui/chargen/portraitselect.cpp b/src/engine/game/gui/chargen/portraitselect.cpp index 6a19b1cc..edbcc532 100644 --- a/src/engine/game/gui/chargen/portraitselect.cpp +++ b/src/engine/game/gui/chargen/portraitselect.cpp @@ -113,7 +113,7 @@ shared_ptr PortraitSelection::getCharacterModel(SceneGraph &scen auto creatureModel = static_pointer_cast(creature->sceneNode()); shared_ptr cameraHook(creatureModel->model()->getNodeByName("camerahook")); if (cameraHook) { - creature->setPosition(glm::vec3(0.0f, 0.0f, -cameraHook->restPosition().z)); + creature->setPosition(glm::vec3(0.0f, 0.0f, -cameraHook->absoluteTransform()[3].z)); } auto model = make_shared(_game->services().graphics().models().get("cghead_light"), ModelUsage::GUI, &sceneGraph); model->attach("cghead_light", creatureModel); diff --git a/src/engine/game/object/area.cpp b/src/engine/game/object/area.cpp index 7d079ef6..d1336e30 100644 --- a/src/engine/game/object/area.cpp +++ b/src/engine/game/object/area.cpp @@ -647,7 +647,7 @@ void Area::update3rdPersonCameraTarget() { auto model = static_pointer_cast(partyLeader->sceneNode()); shared_ptr cameraHook(model->model()->getNodeByName("camerahook")); if (cameraHook) { - position += cameraHook->restPosition(); + position += glm::vec3(cameraHook->absoluteTransform()[3]); } _thirdPersonCamera->setTargetPosition(position);