public Status initSlicedFindPath ( long startRef , long endRef , float [ ] startPos , float [ ] endPos , QueryFilter filter , int options ) { // Init path state. m_query = new QueryData ( ) ; m_query . status = Status . FAILURE ; m_query . startRef = startRef ; m_query . endRef = endRef ; vCopy ( m_query . startPos , startPos ) ; vCopy ( m_query . endPos , endPos ) ; m_query . filter = filter ; m_query . options = options ; m_query . raycastLimitSqr = Float . MAX_VALUE ; // Validate input if ( ! m_nav . isValidPolyRef ( startRef ) || ! m_nav . isValidPolyRef ( endRef ) || Objects . isNull ( startPos ) || ! vIsFinite ( startPos ) || Objects . isNull ( endPos ) || ! vIsFinite ( endPos ) || Objects . isNull ( filter ) ) { return Status . FAILURE_INVALID_PARAM ; } // trade quality with performance? if ( ( options & DT_FINDPATH_ANY_ANGLE ) != 0 ) { // limiting to several times the character radius yields nice results. It is not sensitive // so it is enough to compute it from the first tile. MeshTile tile = m_nav . getTileByRef ( startRef ) ; float agentRadius = tile . data . header . walkableRadius ; m_query . raycastLimitSqr = sqr ( agentRadius * NavMesh . DT_RAY_CAST_LIMIT_PROPORTIONS ) ; } if ( startRef == endRef ) { m_query . status = Status . SUCCSESS ; return Status . SUCCSESS ; } m_nodePool . clear ( ) ; m_openList . clear ( ) ; Node startNode = m_nodePool . getNode ( startRef ) ; vCopy ( startNode . pos , startPos ) ; startNode . pidx = 0 ; startNode . cost = 0 ; startNode . total = vDist ( startPos , endPos ) * H_SCALE ; startNode . id = startRef ; startNode . flags = Node . DT_NODE_OPEN ; m_openList . push ( startNode ) ; m_query . status = Status . IN_PROGRESS ; m_query . lastBestNode = startNode ; m_query . lastBestNodeCost = startNode . total ; return m_query . status ; }
Intializes a sliced path query .