1
0
Fork 0
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:
Torben Carrington 2013-05-08 20:47:31 -07:00
parent d20178dd56
commit 4928c9d079

View file

@ -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);