I'm doing a AI using the NavMesh pathfinding solutions, and I don't to want to use a NavMeshAgent because of some limitations (like teleporting when a carved object comes close, etc.),
Thus I made a sort of fusion, moving a Rigidbody on the path of NavMesh.CalculatePath(), this is working quite good so far, but I have trouble detecting the OffMeshLinks on my path (because it's just an array of Vector3).
I can "trick" a bit using NavMesh.Raycast() like above, but it's not working all the time and sometimes detecting OffMeshLinks that aren't one
NavMeshHit hit;
//Raycast between two corners of a path, because OffMeshLink are most of the time over a hole
if (NavMesh.Raycast(_pathCorners[0], _pathCorners[1], out hit, NavMesh.AllAreas))
{
//If the hit position is really close to the corner, it's surely a offmeshlink generate from the NavMesh
//Or if the second corner is higher than the first one, it's surely a offmeshlink I generate myself
if ((hit.position - _pathCorners[0]).sqrMagnitude < 1
|| _pathCorners[0].y < _pathCorners[1].y)
{
ActivateJump(_pathCorners[0], _pathCorners[1]);
}
}
Thanks in advance :)