X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2Fai.cpp;h=4b76856ea9664db0bb5dc17681155bfe501090be;hb=f5de855fbd4bf5b0df1cad950cbe9069e41369ca;hp=0d4c9e9158256011e3477e595a93472cd52d4e8a;hpb=5c0d6397cfdec3a284a6560c3c6b3acbcd9f9331;p=blank.git diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index 0d4c9e9..4b76856 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -281,7 +281,7 @@ glm::vec3 AIController::GetObstacleAvoidanceForce(const Entity &e, const EntityS for (WorldCollision &c : col) { // diff points from block to state glm::vec3 diff = state.RelativePosition(c.ChunkPos()) - c.BlockCoords(); - float dist = length_squared(diff); + float dist = length2(diff); if (dist < distance) { nearest = &c; difference = diff; @@ -530,7 +530,7 @@ void ChaseState::Update(AIController &ctrl, Entity &e, float dt) const { return; } // halt if we're close enough, flee if we're too close - float dist_sq = length_squared(e.AbsoluteDifference(ctrl.GetPursuitTarget())); + float dist_sq = length2(e.AbsoluteDifference(ctrl.GetPursuitTarget())); if (dist_sq < 8.0f) { ctrl.SetFleeTarget(ctrl.GetPursuitTarget()); ctrl.SetState(flee);