cassius Posted April 12, 2016 Share Posted April 12, 2016 Can anyone tell me, can GetDistance "see" over or through hills in terrain? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
thehankinator Posted April 12, 2016 Share Posted April 12, 2016 I am pretty sure GetDistance() only takes into account the position of the 2 entities, ignores everything else. I think under the hood GetDistance is doing the same thing as: (entity1:GetPosition(true) - entity2:GetPosition(true)):Length() Quote Link to comment Share on other sites More sharing options...
cassius Posted April 12, 2016 Author Share Posted April 12, 2016 Yea. Its just that one of my enemy characters stops following main character sometimes but not always. I wondered if hills got in the way. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
thehankinator Posted April 12, 2016 Share Posted April 12, 2016 Yea. Its just that one of my enemy characters stops following main character sometimes but not always. I wondered if hills got in the way. I've had the same problem with Follow(), I can't remember what I had done to fix it... or if I fixed it at all. Two things stick out in my mind, 1) What does Follow() do when the player is suddenly unreachable? Like if they jumped onto a platform that the navmesh doesn't connect to. 2) Is your script continuously calling Follow()? It'd be nice if the Navigation API had a function like IsFollowing() so that you could detect when the path failed for some reason. Quote Link to comment Share on other sites More sharing options...
cassius Posted April 12, 2016 Author Share Posted April 12, 2016 Yeah. I;m using c++ but follow is in main loop and operates as long as enemy is alive. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
thehankinator Posted April 12, 2016 Share Posted April 12, 2016 Yeah. I;m using c++ but follow is in main loop and operates as long as enemy is alive. Try calling Follow() only once. I think the intended use is to call Follow() to start the following, then only call it again if you change what the entity is following. Quote Link to comment Share on other sites More sharing options...
cassius Posted April 13, 2016 Author Share Posted April 13, 2016 looks like the navmesh does not cover some hills.That might be the problem. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
f13rce Posted April 13, 2016 Share Posted April 13, 2016 If you want distance to be checked with the hills, you can store the waypoints and calculate the distance between each waypoint. When looking at my old code, I think it's being done something like this: std::vector<Vec3> waypoints; //Vec3 targetPos = Vec3(60); world->navmesh->FindPath(model->GetPosition(true), targetPos, waypoints); float distance = 0; for (uint16_t i = 0; i < waypoints.size() - 1; ++i) // you can also use unsigned int instead { distance += waypoints[i].DistanceToPoint( waypoints[i + 1] ); } printf("Total distance is: %0.2f\n", distance); Quote Using Leadwerks Professional Edition (Beta), mainly using C++. Windows 10 / Linux Mint, Visual Studio 2017. GPU: NVidia GeForce GTX970, CPU: Intel i7 7700K @ 4.20 GHz Previously known as Evayr. Link to comment Share on other sites More sharing options...
cassius Posted April 13, 2016 Author Share Posted April 13, 2016 Interesting. Thanks. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.