mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 04:45:32 +00:00
change aim calculation
This commit is contained in:
parent
52eccf1a2d
commit
e56efdd562
1 changed files with 6 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue