Kaynağa Gözat

Simplified sample 15

Mike3D 11 yıl önce
ebeveyn
işleme
be94437b69

+ 1 - 1
Bin/Data/LuaScripts/15_Navigation.lua

@@ -318,7 +318,7 @@ function FollowPath(timeStep)
         jackNode:Translate(Vector3(0.0, 0.0, 1.0) * move)
         jackNode:Translate(Vector3(0.0, 0.0, 1.0) * move)
 
 
         -- Remove waypoint if reached it
         -- Remove waypoint if reached it
-        if (jackNode.position - nextWaypoint):Length() < 0.1 then
+        if distance < 0.1 then
             table.remove(currentPath, 1)
             table.remove(currentPath, 1)
         end
         end
     end
     end

+ 1 - 1
Bin/Data/Scripts/15_Navigation.as

@@ -325,7 +325,7 @@ void FollowPath(float timeStep)
         jackNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * move);
         jackNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * move);
 
 
         // Remove waypoint if reached it
         // Remove waypoint if reached it
-        if ((jackNode.position - nextWaypoint).length < 0.1)
+        if (distance < 0.1)
             currentPath.Erase(0);
             currentPath.Erase(0);
     }
     }
 }
 }

+ 1 - 1
Source/Samples/15_Navigation/Navigation.cpp

@@ -384,7 +384,7 @@ void Navigation::FollowPath(float timeStep)
         jackNode_->Translate(Vector3::FORWARD * move);
         jackNode_->Translate(Vector3::FORWARD * move);
 
 
         // Remove waypoint if reached it
         // Remove waypoint if reached it
-        if ((jackNode_->GetPosition() - nextWaypoint).Length() < 0.1f)
+        if (distance < 0.1f)
             currentPath_.Erase(0);
             currentPath_.Erase(0);
     }
     }
 }
 }