mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-24 11:28:22 +02:00
moved pathing crap out of actor
- despawn actors on moving too far from spawn - added clampy stuff (<3 devi)
This commit is contained in:
parent
bd97e72774
commit
a62475e81e
12 changed files with 308 additions and 239 deletions
|
@ -94,15 +94,6 @@ namespace FFXIVClassic_Map_Server.utils
|
|||
return false;
|
||||
}
|
||||
|
||||
public static Detour.dtNavMesh LoadNavmesh(string path)
|
||||
{
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
var start = 0;
|
||||
|
||||
var navmesh = Detour.NavMeshSetBuild.FromBytes(bytes, ref start);
|
||||
return navmesh;
|
||||
}
|
||||
|
||||
public static SharpNav.TiledNavMesh LoadNavmesh(TiledNavMesh navmesh, string filePath)
|
||||
{
|
||||
var serialiser = new SharpNav.IO.Json.NavMeshJsonSerializer();
|
||||
|
@ -110,14 +101,6 @@ namespace FFXIVClassic_Map_Server.utils
|
|||
//return navmesh = new SharpNav.IO.Json.NavMeshJsonSerializer().Deserialize(filePath);
|
||||
}
|
||||
|
||||
public static List<Vector3> GetPath(Detour.dtNavMesh navmesh, Vector3 start, Vector3 end)
|
||||
{
|
||||
var path = new Vector3[] { };
|
||||
|
||||
|
||||
return path.ToList();
|
||||
}
|
||||
|
||||
#region sharpnav stuff
|
||||
// Copyright (c) 2013-2016 Robert Rouhani <robert.rouhani@gmail.com> and other contributors (see CONTRIBUTORS file).
|
||||
// Licensed under the MIT License - https://raw.github.com/Robmaister/SharpNav/master/LICENSE
|
||||
|
@ -127,16 +110,19 @@ namespace FFXIVClassic_Map_Server.utils
|
|||
var navMesh = zone.tiledNavMesh;
|
||||
var navMeshQuery = zone.navMeshQuery;
|
||||
|
||||
if (navMesh == null || (startVec.X == endVec.X && startVec.Y == endVec.Y && startVec.Z == endVec.Z))
|
||||
if (navMesh == null || (startVec.X == endVec.X && startVec.Y == endVec.Y && startVec.Z == endVec.Z && polyRadius == 0.0f))
|
||||
{
|
||||
Program.Log.Error("ass");
|
||||
return null;
|
||||
}
|
||||
|
||||
float distanceSquared = FFXIVClassic.Common.Utils.DistanceSquared(startVec.X, startVec.Y, startVec.Z, endVec.X, endVec.Y, endVec.Z);
|
||||
// we dont care about distance if picking random point
|
||||
float distanceSquared = polyRadius == 0.0f ? FFXIVClassic.Common.Utils.DistanceSquared(startVec.X, startVec.Y, startVec.Z, endVec.X, endVec.Y, endVec.Z) : 100;
|
||||
|
||||
// no point pathing if in range
|
||||
if (distanceSquared < 4 && Math.Abs(startVec.Y - endVec.Y) < 1.1f)
|
||||
{
|
||||
Program.Log.Error("shit");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -145,8 +131,6 @@ namespace FFXIVClassic_Map_Server.utils
|
|||
NavQueryFilter filter = new NavQueryFilter();
|
||||
|
||||
NavPoint startPt, endPt;
|
||||
RaycastHit hit;
|
||||
PathCorridor corridor = new PathCorridor();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -172,6 +156,9 @@ namespace FFXIVClassic_Map_Server.utils
|
|||
|
||||
smoothPath.Add(new Vector3(iterPos));
|
||||
|
||||
if (npolys <= 1)
|
||||
System.Diagnostics.Debugger.Break();
|
||||
|
||||
//float STEP_SIZE = 0.70f;
|
||||
float SLOP = 0.15f;
|
||||
while (npolys > 0 && smoothPath.Count < smoothPath.Capacity)
|
||||
|
@ -214,7 +201,7 @@ namespace FFXIVClassic_Map_Server.utils
|
|||
iterPos = result;
|
||||
|
||||
//handle end of path when close enough
|
||||
if (endOfPath && InRange(iterPos, steerPos, SLOP, 1000.0f))
|
||||
if (endOfPath && InRange(iterPos, steerPos, SLOP, 10.0f))
|
||||
{
|
||||
//reached end of path
|
||||
iterPos = targetPos;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue