So first off, this did result from a detour from the basic course. Using the Terrain that the course does, everything works fine, but if I use objects as floor tiles (set to static and baked) SamplePosition always returns false, with a mask of 0.
The NavMesh shows up as blue with the gizmo’s, and it’s perfectly walkable and workable in every other way, but I’m trying to set the walk cursor by detecting the NavMesh, which doesn’t work with this problem.
I can only imagine there’s some sort of ‘aiming’ issue with the NavMeshHit, but having done the check with a single Raycast and a RaycastAll array, nothing works.
Ideas? Would appreciate the help!
~ Zephyr
Edit:
Some code may help I imagine! Though without linking or dumping a ton, it’s pretty basic stuff. The SamplePosition below is the false return. testCursor is a struct with variable types that should be clear from their usage.
private void RunAllCursorTests()
{
RaycastHit hitRay;
testCursor.hitCheck = Physics.Raycast(GetMouseRay(), out hitRay);
testCursor.hitPoint = hitRay.point;
testCursor.hitNavCheck = NavMesh.SamplePosition(testCursor.hitPoint, out testCursor.hitNavPoint, maxNavCheckDistance, NavMesh.AllAreas);
testNavPath = GetNavMeshPath(transform.position, testCursor.hitPoint);
bool isBlocked = NavMesh.Raycast(transform.position + new Vector3(0, .5f, 0), testCursor.hitPoint, out testNavPath.navPathEnd, NavMesh.AllAreas);
//if (testNavPath.navPathDistance > maxPathLength) { return; } // Path too long, escape Update()
testCursor.hitRayAll = RaycastAllSorted();
RaycastAllCheck();
}