From 74126953fc1884b4933dbb4b14f06846431e04d3 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 1 Apr 2023 11:47:53 +0400 Subject: [PATCH] Do not use a rendering node position as a hit position (bug 7298) --- CHANGELOG.md | 1 + apps/openmw/mwworld/projectilemanager.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03a5cee139..732f5f341e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty Bug #7229: Error marker loading failure is not handled Bug #7243: Get Skyrim.esm loading + Bug #7298: Water ripples from projectiles sometimes are not spawned Feature #5492: Let rain and snow collide with statics Feature #6447: Add LOD support to Object Paging Feature #6726: Lua API for creating new objects diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index 1b8a0035fb..b0c5853388 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -546,11 +547,14 @@ namespace MWWorld if (invIt != inv.end() && invIt->getCellRef().getRefId() == projectileState.mBowId) bow = *invIt; } + + const auto hitPosition = Misc::Convert::toOsg(projectile->getHitPosition()); + if (projectile->getHitWater()) - mRendering->emitWaterRipple(pos); + mRendering->emitWaterRipple(hitPosition); MWMechanics::projectileHit( - caster, target, bow, projectileRef.getPtr(), pos, projectileState.mAttackStrength); + caster, target, bow, projectileRef.getPtr(), hitPosition, projectileState.mAttackStrength); projectileState.mToDelete = true; } const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore(); @@ -574,7 +578,7 @@ namespace MWWorld assert(target != caster); MWMechanics::CastSpell cast(caster, target); - cast.mHitPosition = pos; + cast.mHitPosition = Misc::Convert::toOsg(projectile->getHitPosition()); cast.mId = magicBoltState.mSpellId; cast.mSourceName = magicBoltState.mSourceName; cast.mSlot = magicBoltState.mSlot;