mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
Merge branch 'respect_almas_personal_space' into 'master'
Tweak follow distance to be more like the original See merge request OpenMW/openmw!530
This commit is contained in:
commit
f150a92775
1 changed files with 14 additions and 3 deletions
|
@ -14,6 +14,16 @@
|
||||||
#include "movement.hpp"
|
#include "movement.hpp"
|
||||||
#include "steering.hpp"
|
#include "steering.hpp"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
osg::Vec3f::value_type getHalfExtents(const MWWorld::ConstPtr& actor)
|
||||||
|
{
|
||||||
|
if(actor.getClass().isNpc())
|
||||||
|
return 64;
|
||||||
|
return MWBase::Environment::get().getWorld()->getHalfExtents(actor).y();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
int AiFollow::mFollowIndexCounter = 0;
|
int AiFollow::mFollowIndexCounter = 0;
|
||||||
|
@ -121,13 +131,14 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
{
|
{
|
||||||
for(auto& follower : followers)
|
for(auto& follower : followers)
|
||||||
{
|
{
|
||||||
auto halfExtent = MWBase::Environment::get().getWorld()->getHalfExtents(follower.second).y();
|
auto halfExtent = getHalfExtents(follower.second);
|
||||||
if(halfExtent > floatingDistance)
|
if(halfExtent > floatingDistance)
|
||||||
floatingDistance = halfExtent;
|
floatingDistance = halfExtent;
|
||||||
}
|
}
|
||||||
|
floatingDistance += 128;
|
||||||
}
|
}
|
||||||
floatingDistance += MWBase::Environment::get().getWorld()->getHalfExtents(target).y();
|
floatingDistance += getHalfExtents(target) + 64;
|
||||||
floatingDistance += MWBase::Environment::get().getWorld()->getHalfExtents(actor).y() * 2;
|
floatingDistance += getHalfExtents(actor) * 2;
|
||||||
short followDistance = static_cast<short>(floatingDistance);
|
short followDistance = static_cast<short>(floatingDistance);
|
||||||
|
|
||||||
if (!mAlwaysFollow) //Update if you only follow for a bit
|
if (!mAlwaysFollow) //Update if you only follow for a bit
|
||||||
|
|
Loading…
Reference in a new issue