diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 01b90e907..e5fa7322c 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3867,11 +3867,14 @@ namespace MWWorld return false; } - osg::Vec3f World::aimToTarget(const ConstPtr &actor, const MWWorld::ConstPtr& target) + osg::Vec3f World::aimToTarget(const ConstPtr &actor, const ConstPtr &target) { osg::Vec3f weaponPos = actor.getRefData().getPosition().asVec3(); - weaponPos.z() += mPhysics->getHalfExtents(actor).z(); - osg::Vec3f targetPos = mPhysics->getCollisionObjectPosition(target); + osg::Vec3f weaponHalfExtents = mPhysics->getHalfExtents(actor); + osg::Vec3f targetPos = target.getRefData().getPosition().asVec3(); + osg::Vec3f targetHalfExtents = mPhysics->getHalfExtents(target); + weaponPos.z() += weaponHalfExtents.z() * 2 * 0.75; // projectilemanager.cpp spawns bolts at 0.75 actor height + targetPos.z() += targetHalfExtents.z(); return (targetPos - weaponPos); }