Merge branch 'hitpos' into 'master'

Do not use a rendering node position as a hit position

See merge request OpenMW/openmw!2879
depth-refraction
psi29a 2 years ago
commit 912d7521c4

@ -50,6 +50,7 @@
Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty
Bug #7229: Error marker loading failure is not handled Bug #7229: Error marker loading failure is not handled
Bug #7243: Get Skyrim.esm loading 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 #5492: Let rain and snow collide with statics
Feature #6447: Add LOD support to Object Paging Feature #6447: Add LOD support to Object Paging
Feature #6726: Lua API for creating new objects Feature #6726: Lua API for creating new objects

@ -16,6 +16,7 @@
#include <components/esm3/projectilestate.hpp> #include <components/esm3/projectilestate.hpp>
#include <components/misc/constants.hpp> #include <components/misc/constants.hpp>
#include <components/misc/convert.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
@ -546,11 +547,14 @@ namespace MWWorld
if (invIt != inv.end() && invIt->getCellRef().getRefId() == projectileState.mBowId) if (invIt != inv.end() && invIt->getCellRef().getRefId() == projectileState.mBowId)
bow = *invIt; bow = *invIt;
} }
const auto hitPosition = Misc::Convert::toOsg(projectile->getHitPosition());
if (projectile->getHitWater()) if (projectile->getHitWater())
mRendering->emitWaterRipple(pos); mRendering->emitWaterRipple(hitPosition);
MWMechanics::projectileHit( MWMechanics::projectileHit(
caster, target, bow, projectileRef.getPtr(), pos, projectileState.mAttackStrength); caster, target, bow, projectileRef.getPtr(), hitPosition, projectileState.mAttackStrength);
projectileState.mToDelete = true; projectileState.mToDelete = true;
} }
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
@ -574,7 +578,7 @@ namespace MWWorld
assert(target != caster); assert(target != caster);
MWMechanics::CastSpell cast(caster, target); MWMechanics::CastSpell cast(caster, target);
cast.mHitPosition = pos; cast.mHitPosition = Misc::Convert::toOsg(projectile->getHitPosition());
cast.mId = magicBoltState.mSpellId; cast.mId = magicBoltState.mSpellId;
cast.mSourceName = magicBoltState.mSourceName; cast.mSourceName = magicBoltState.mSourceName;
cast.mSlot = magicBoltState.mSlot; cast.mSlot = magicBoltState.mSlot;

Loading…
Cancel
Save