Hello, I have a top down 2.5D game and I’m using 2DNavmeshPlus, but I’m not exactly sure if it’s related to it.
So I’m trying to have a player follow the mouse cursor on hold.
I stripped the script to the bare minimum:
Update()
{
navMeshAgent.SetDestination(hit2D.point);
print(navMeshAgent.hasPath)
}
//hit 2d is this
Vector2 mousePosition = gameInput.GetMousePosition();
Ray ray = WM.cam.ScreenPointToRay(mousePosition);
hit2D = Physics2D.GetRayIntersection(ray);
The problem is when I click and hold an inaccessible area, for example inside the rectangle:
the log keeps returning both true and false. It causes the player to occasionally jitter slightly which is kinda annoying, plus I need this check for other things. I’ve tried other checks like Path status, it’s pretty much the same thing.
My question is: what’s a good way of detecting inaccessible areas on update?