Fix blaster bolts trajectory

This commit is contained in:
Vsevolod Kremianskii 2021-06-05 09:53:22 +07:00
parent 79a4af45ad
commit 8d5cdbdc7d
3 changed files with 4 additions and 4 deletions

View file

@ -54,7 +54,7 @@ void Combat::fireProjectile(const shared_ptr<Creature> &attacker, const shared_p
glm::vec3 projectilePos;
shared_ptr<ModelNode> 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<Creature> &attacker, const shared_p
glm::vec3 projectileTarget;
shared_ptr<ModelNode> 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();
}

View file

@ -113,7 +113,7 @@ shared_ptr<ModelSceneNode> PortraitSelection::getCharacterModel(SceneGraph &scen
auto creatureModel = static_pointer_cast<ModelSceneNode>(creature->sceneNode());
shared_ptr<ModelNode> 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<ModelSceneNode>(_game->services().graphics().models().get("cghead_light"), ModelUsage::GUI, &sceneGraph);
model->attach("cghead_light", creatureModel);

View file

@ -647,7 +647,7 @@ void Area::update3rdPersonCameraTarget() {
auto model = static_pointer_cast<ModelSceneNode>(partyLeader->sceneNode());
shared_ptr<ModelNode> cameraHook(model->model()->getNodeByName("camerahook"));
if (cameraHook) {
position += cameraHook->restPosition();
position += glm::vec3(cameraHook->absoluteTransform()[3]);
}
_thirdPersonCamera->setTargetPosition(position);