From a85932a62baea0b4967e79125b8186843b880470 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 10 Jun 2016 23:33:47 +0200 Subject: [PATCH] Ignore the collision box offset when launching projectiles (Fixes #3201) --- apps/openmw/mwworld/projectilemanager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index 3fafadec3..90fba827f 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -117,11 +117,13 @@ namespace MWWorld const ESM::EffectList &effects, const Ptr &caster, const std::string &sourceName, const osg::Vec3f& fallbackDirection) { - osg::Vec3f pos; + osg::Vec3f pos = caster.getRefData().getPosition().asVec3(); if (caster.getClass().isActor()) - pos = mPhysics->getCollisionObjectPosition(caster) + osg::Vec3f(0,0,mPhysics->getHalfExtents(caster).z() * 0.5); // Spawn at 0.75 * ActorHeight - else - pos = caster.getRefData().getPosition().asVec3(); + { + // Spawn at 0.75 * ActorHeight + // Note: we ignore the collision box offset, this is required to make some flying creatures work as intended. + pos.z() += mPhysics->getHalfExtents(caster).z() * 2 * 0.75; + } if (MWBase::Environment::get().getWorld()->isUnderwater(caster.getCell(), pos)) // Underwater casting not possible return;