1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Improve area orb positioning for "on touch" spells

This commit is contained in:
scrawl 2015-06-03 03:04:39 +02:00
parent cd47dff196
commit cee1db532f

View File

@ -2636,11 +2636,14 @@ namespace MWWorld
// Get the target to use for "on touch" effects
MWWorld::Ptr target;
float distance = 192.f; // ??
osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3();
if (actor == getPlayerPtr())
{
// For the player, use camera to aim
target = getFacedObject(distance);
if (!target.isEmpty())
hitPosition = target.getRefData().getPosition().asVec3();
}
else
{
@ -2669,13 +2672,13 @@ namespace MWWorld
MWPhysics::PhysicsSystem::RayResult result = mPhysics->castRay(origin, dest, actor);
target = result.mHitObject;
hitPosition = result.mHitPos;
}
std::string selectedSpell = stats.getSpells().getSelectedSpell();
MWMechanics::CastSpell cast(actor, target);
if (!target.isEmpty())
cast.mHitPosition = target.getRefData().getPosition().asVec3();
cast.mHitPosition = hitPosition;
if (!selectedSpell.empty())
{