1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 13:11:32 +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 // Get the target to use for "on touch" effects
MWWorld::Ptr target; MWWorld::Ptr target;
float distance = 192.f; // ?? float distance = 192.f; // ??
osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3();
if (actor == getPlayerPtr()) if (actor == getPlayerPtr())
{ {
// For the player, use camera to aim // For the player, use camera to aim
target = getFacedObject(distance); target = getFacedObject(distance);
if (!target.isEmpty())
hitPosition = target.getRefData().getPosition().asVec3();
} }
else else
{ {
@ -2669,13 +2672,13 @@ namespace MWWorld
MWPhysics::PhysicsSystem::RayResult result = mPhysics->castRay(origin, dest, actor); MWPhysics::PhysicsSystem::RayResult result = mPhysics->castRay(origin, dest, actor);
target = result.mHitObject; target = result.mHitObject;
hitPosition = result.mHitPos;
} }
std::string selectedSpell = stats.getSpells().getSelectedSpell(); std::string selectedSpell = stats.getSpells().getSelectedSpell();
MWMechanics::CastSpell cast(actor, target); MWMechanics::CastSpell cast(actor, target);
if (!target.isEmpty()) cast.mHitPosition = hitPosition;
cast.mHitPosition = target.getRefData().getPosition().asVec3();
if (!selectedSpell.empty()) if (!selectedSpell.empty())
{ {