mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
feat(Core/CreatureAI): improve npc position during the combat (#3369)
+ tangent equation to find correct angle and distance when moving + implemented proper backward * Improved performance + random angle margin * chore: add tollerance calculation in instance * improved LOS checks with movements * implemented collisions using raycast (imported by TC) + improved collision detection for CanReachPositionAndGetCoords + improved collision check + set correct flags for the backward movement + first implementation of slope angle (to improve) Co-authored-by: Yehonal <yehonal.azeroth@gmail.com>
This commit is contained in:
@@ -85,9 +85,11 @@ public:
|
||||
if (para && strcmp(para, "true") == 0)
|
||||
useStraightPath = true;
|
||||
|
||||
bool useStraightLine = false;
|
||||
if (para && strcmp(para, "line") == 0)
|
||||
useStraightLine = true;
|
||||
bool useRaycast = false;
|
||||
if (para && (strcmp(para, "line") == 0 || strcmp(para, "ray") == 0 || strcmp(para, "raycast") == 0))
|
||||
{
|
||||
useRaycast = true;
|
||||
}
|
||||
|
||||
// unit locations
|
||||
float x, y, z;
|
||||
@@ -96,11 +98,12 @@ public:
|
||||
// path
|
||||
PathGenerator path(target);
|
||||
path.SetUseStraightPath(useStraightPath);
|
||||
path.SetUseRaycast(useRaycast);
|
||||
bool result = path.CalculatePath(x, y, z, false);
|
||||
|
||||
Movement::PointsArray const& pointPath = path.GetPath();
|
||||
handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str());
|
||||
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : useStraightLine ? "Raycast" : "SmoothPath");
|
||||
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : useRaycast ? "Raycast" : "SmoothPath");
|
||||
handler->PSendSysMessage("Result: %s - Length: " SZFMTD " - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
|
||||
|
||||
G3D::Vector3 const& start = path.GetStartPosition();
|
||||
|
||||
Reference in New Issue
Block a user