mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
Merge branch 'issue-5680' into 'master'
change aim calculation See merge request OpenMW/openmw!685
This commit is contained in:
commit
b61337643e
6 changed files with 16 additions and 7 deletions
|
@ -131,6 +131,7 @@ Programmers
|
|||
Martin Otto (MAtahualpa)
|
||||
Mateusz Kołaczek (PL_kolek)
|
||||
Mateusz Malisz (malice)
|
||||
Max Henzerling (SaintMercury)
|
||||
megaton
|
||||
Michael Hogan (Xethik)
|
||||
Michael Mc Donnell
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
Bug #5656: Sneaking characters block hits while standing
|
||||
Bug #5661: Region sounds don't play at the right interval
|
||||
Bug #5675: OpenMW-cs. FRMR subrecords are saved with the wrong MastIdx
|
||||
Bug #5680: Bull Netches incorrectly aim over the player character's head and always miss
|
||||
Bug #5681: Player character can clip or pass through bridges instead of colliding against them
|
||||
Bug #5687: Bound items covering the same inventory slot expiring at the same time freezes the game
|
||||
Bug #5688: Water shader broken indoors with enable indoor shadows = false
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "aicast.hpp"
|
||||
|
||||
#include <components/misc/constants.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -54,12 +56,12 @@ bool MWMechanics::AiCast::execute(const MWWorld::Ptr& actor, MWMechanics::Charac
|
|||
if (target != actor && target.getClass().isActor())
|
||||
{
|
||||
osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getHalfExtents(target);
|
||||
targetPos.z() += halfExtents.z() * 2 * 0.75f;
|
||||
targetPos.z() += halfExtents.z() * 2 * Constants::TorsoHeight;
|
||||
}
|
||||
|
||||
osg::Vec3f actorPos = actor.getRefData().getPosition().asVec3();
|
||||
osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getHalfExtents(actor);
|
||||
actorPos.z() += halfExtents.z() * 2 * 0.75f;
|
||||
actorPos.z() += halfExtents.z() * 2 * Constants::TorsoHeight;
|
||||
|
||||
osg::Vec3f dir = targetPos - actorPos;
|
||||
|
||||
|
|
|
@ -265,9 +265,8 @@ namespace MWWorld
|
|||
osg::Vec3f pos = caster.getRefData().getPosition().asVec3();
|
||||
if (caster.getClass().isActor())
|
||||
{
|
||||
// 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->getRenderingHalfExtents(caster).z() * 2 * 0.75;
|
||||
pos.z() += mPhysics->getRenderingHalfExtents(caster).z() * 2 * Constants::TorsoHeight;
|
||||
}
|
||||
|
||||
if (MWBase::Environment::get().getWorld()->isUnderwater(caster.getCell(), pos)) // Underwater casting not possible
|
||||
|
|
|
@ -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 * Constants::TorsoHeight;
|
||||
targetPos.z() += targetHalfExtents.z();
|
||||
return (targetPos - weaponPos);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ const std::string NightDayLabel = "NightDaySwitch";
|
|||
// A label to mark visual switches for herbalism feature
|
||||
const std::string HerbalismLabel = "HerbalismSwitch";
|
||||
|
||||
// Percentage height at which projectiles are spawned from an actor
|
||||
const float TorsoHeight = 0.75f;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue