Support Forum

Path.error false on tile higher than climb height

As shown in picture, the green hex icon (no collider attached)
is on a tile that y position is 30.5, and the tile nearby is 10.5,
robot y position is 0, climb height is 11. The scan also fine as shown.

But the debug log show false when mouse point to the green tile. I think path.error should be true on the green tile.

 void DrawRobotMoveLine()
    {
        walkLine.enabled = true;
        walkLine.startColor = Color.green;
        walkLine.endColor = Color.green;
        selectRBCursor.gameObject.SetActive(true);

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (selectedRobot)
        {
            if (Physics.Raycast(ray, out hit))
            {                
                if (hit.transform.CompareTag(Data.TagTerrain) && TileManagement.TileIsEmpty(hit.transform.position))
                {
                    // on terrain
                    var path = selectedRobotSeeker.StartPath(selectedRobot.position, hit.transform.position, OnPathComplete);
                    path.BlockUntilCalculated();
                }
                else
                {
                    // on building
                    BuildingManager fm = hit.transform.GetComponent<BuildingManager>();
                    if (fm && fm.type == BuildingManager.Type.RBLauncher)
                    {
                        var path = selectedRobotSeeker.StartPath(selectedRobot.position, hit.transform.position, OnPathComplete);
                        path.BlockUntilCalculated();
                    }
                    else
                    {
                        // on enemy robot
                        RobotAI _rbAI = hit.transform.root.GetComponent<RobotAI>();
                        if (_rbAI && !hit.transform.root.CompareTag(selectedRobot.tag))
                        {
                            selectRBCursor.position = hit.transform.root.position;
                            selectRBCursor.GetComponent<Renderer>().material = redColor;
                        }
                    }
                }
            }            
            void OnPathComplete(Pathfinding.Path p)
            {
                Debug.Log(Time.time + " " + p.error);
                if (!p.error && TileManagement.MoveStepCheck(p.vectorPath.Count, selectedRobotAI.MaxMoveStep))
                {
                    selectedUnitDestination = TileManagement.GetTileTopSurfacePoint(hit.transform.position);

                    // shift up, so not overlap with map
                    walkLine.SetPosition(0, selectedRobot.position + 0.2f * Vector3.up);
                    walkLine.SetPosition(1, selectedUnitDestination + 0.2f * Vector3.up);
                    selectRBCursor.position = selectedUnitDestination;
                    selectRBCursor.GetComponent<Renderer>().material = greenColor;
                }
            }
        }