mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 07:11:33 +00:00
Improve area orb positioning for "on touch" spells
This commit is contained in:
parent
cd47dff196
commit
cee1db532f
1 changed files with 5 additions and 2 deletions
|
@ -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())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue