mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 12:53:53 +00:00
Removed sqrt function call (minor optimization thanks to Chris)
This commit is contained in:
parent
d20178dd56
commit
4928c9d079
1 changed files with 2 additions and 3 deletions
|
@ -1,5 +1,4 @@
|
|||
#include "aiescort.hpp"
|
||||
#include <cmath>
|
||||
|
||||
#include "character.hpp"
|
||||
#include "movement.hpp"
|
||||
|
@ -156,9 +155,9 @@ bool MWMechanics::AiEscort::execute (const MWWorld::Ptr& actor)
|
|||
differenceBetween[i] = (leaderPos[i] - followerPos[i]);
|
||||
|
||||
float distanceBetweenResult =
|
||||
std::sqrt((differenceBetween[0] * differenceBetween[0]) + (differenceBetween[1] * differenceBetween[1]) + (differenceBetween[2] * differenceBetween[2]));
|
||||
(differenceBetween[0] * differenceBetween[0]) + (differenceBetween[1] * differenceBetween[1]) + (differenceBetween[2] * differenceBetween[2]);
|
||||
|
||||
if(distanceBetweenResult <= mMaxDist)
|
||||
if(distanceBetweenResult <= mMaxDist * mMaxDist)
|
||||
{
|
||||
float zAngle = mPathFinder.getZAngleToNext(pos.pos[0],pos.pos[1],pos.pos[2]);
|
||||
MWBase::Environment::get().getWorld()->rotateObject(actor,0,0,zAngle,false);
|
||||
|
|
Loading…
Reference in a new issue