private static Matrix4x4 PolygonWorldToLocalMatrix(IntPtr navMeshQuery, PolygonId polygon)
        {
            Matrix4x4 result;

            NavMeshQuery.PolygonWorldToLocalMatrix_Injected(navMeshQuery, ref polygon, out result);
            return(result);
        }
示例#2
0
        public NavMeshLocation CreateLocation(Vector3 position, PolygonId polygon)
        {
            Vector3 nearest;
            var     status = GetClosestPointOnPoly(m_NavMeshQuery, polygon, position, out nearest);

            return((status & PathQueryStatus.Success) != 0 ? new NavMeshLocation(nearest, polygon) : new NavMeshLocation());
        }
        public NavMeshLocation CreateLocation(Vector3 position, PolygonId polygon)
        {
            AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
            Vector3         position2;
            PathQueryStatus closestPointOnPoly = NavMeshQuery.GetClosestPointOnPoly(this.m_NavMeshQuery, polygon, position, out position2);

            return(((closestPointOnPoly & PathQueryStatus.Success) != (PathQueryStatus)0) ? new NavMeshLocation(position2, polygon) : default(NavMeshLocation));
        }
        public NavMeshLocation CreateLocation(Vector3 position, PolygonId polygon)
        {
            AtomicSafetyHandle.CheckReadAndThrow(m_Safety);
            Vector3 nearest;
            var     status = GetClosestPointOnPoly(m_NavMeshQuery, polygon, position, out nearest);

            return((status & PathQueryStatus.Success) != 0 ? new NavMeshLocation(nearest, polygon) : new NavMeshLocation());
        }
        public unsafe PathQueryStatus GetEdgesAndNeighbors(PolygonId node, NativeSlice <Vector3> edgeVertices, NativeSlice <PolygonId> neighbors, NativeSlice <byte> edgeIndices, out int verticesCount, out int neighborsCount)
        {
            AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
            bool flag = edgeIndices.Length != neighbors.Length && neighbors.Length > 0 && edgeIndices.Length > 0;

            if (flag)
            {
                throw new ArgumentException(string.Format("The length of the {0} buffer ({1}) ", "edgeIndices", edgeIndices.Length) + string.Format("needs to be the same as that of the {0} buffer ({1}) ", "neighbors", neighbors.Length) + "because the elements from the two arrays will pair up at the same index.");
            }
            void *verts        = (edgeVertices.Length > 0) ? edgeVertices.GetUnsafePtr <Vector3>() : null;
            void *neighbors2   = (neighbors.Length > 0) ? neighbors.GetUnsafePtr <PolygonId>() : null;
            void *edgeIndices2 = (edgeIndices.Length > 0) ? edgeIndices.GetUnsafePtr <byte>() : null;
            int   length       = edgeVertices.Length;
            int   maxNei       = (neighbors.Length > 0) ? neighbors.Length : edgeIndices.Length;

            return(NavMeshQuery.GetEdgesAndNeighbors(this.m_NavMeshQuery, node, length, maxNei, verts, neighbors2, edgeIndices2, out verticesCount, out neighborsCount));
        }
        public unsafe PathQueryStatus GetEdgesAndNeighbors(PolygonId node,
                                                           NativeSlice <Vector3> edgeVertices, NativeSlice <PolygonId> neighbors, NativeSlice <byte> edgeIndices,
                                                           out int verticesCount, out int neighborsCount)
        {
            AtomicSafetyHandle.CheckReadAndThrow(m_Safety);

            if (edgeIndices.Length != neighbors.Length && neighbors.Length > 0 && edgeIndices.Length > 0)
            {
                throw new ArgumentException($"The length of the {nameof(edgeIndices)} buffer ({edgeIndices.Length}) " +
                                            $"needs to be the same as that of the {nameof(neighbors)} buffer ({neighbors.Length}) " +
                                            "because the elements from the two arrays will pair up at the same index.");
            }
            var vertPtr      = edgeVertices.Length > 0 ? edgeVertices.GetUnsafePtr() : null;
            var neiPtr       = neighbors.Length > 0 ? neighbors.GetUnsafePtr() : null;
            var edgesPtr     = edgeIndices.Length > 0 ? edgeIndices.GetUnsafePtr() : null;
            var maxVertices  = edgeVertices.Length;
            var maxNeighbors = neighbors.Length > 0 ? neighbors.Length : edgeIndices.Length;
            var status       = GetEdgesAndNeighbors(m_NavMeshQuery, node, maxVertices, maxNeighbors,
                                                    vertPtr, neiPtr, edgesPtr,
                                                    out verticesCount, out neighborsCount);

            return(status);
        }
 public Matrix4x4 PolygonWorldToLocalMatrix(PolygonId polygon)
 {
     AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
     return(NavMeshQuery.PolygonWorldToLocalMatrix(this.m_NavMeshQuery, polygon));
 }
示例#8
0
 public NavMeshPolyTypes GetPolygonType(PolygonId polygon)
 {
     return(GetPolygonType(m_NavMeshQuery, polygon));
 }
 private static extern bool IsPositionInPolygon_Injected(IntPtr navMeshQuery, ref Vector3 position, ref PolygonId polygon);
 private static extern bool IsValidPolygon_Injected(IntPtr navMeshQuery, ref PolygonId polygon);
 private unsafe static PathQueryStatus GetEdgesAndNeighbors(IntPtr navMeshQuery, PolygonId node, int maxVerts, int maxNei, void *verts, void *neighbors, void *edgeIndices, out int vertCount, out int neighborsCount)
 {
     return(NavMeshQuery.GetEdgesAndNeighbors_Injected(navMeshQuery, ref node, maxVerts, maxNei, verts, neighbors, edgeIndices, out vertCount, out neighborsCount));
 }
 public int GetAgentTypeIdForPolygon(PolygonId polygon)
 {
     AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
     return(NavMeshQuery.GetAgentTypeIdForPolygon(this.m_NavMeshQuery, polygon));
 }
 private static int GetAgentTypeIdForPolygon(IntPtr navMeshQuery, PolygonId polygon)
 {
     return(NavMeshQuery.GetAgentTypeIdForPolygon_Injected(navMeshQuery, ref polygon));
 }
 public bool IsValid(PolygonId polygon)
 {
     AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
     return(polygon.polyRef != 0uL && NavMeshQuery.IsValidPolygon(this.m_NavMeshQuery, polygon));
 }
 private static bool IsValidPolygon(IntPtr navMeshQuery, PolygonId polygon)
 {
     return(NavMeshQuery.IsValidPolygon_Injected(navMeshQuery, ref polygon));
 }
示例#16
0
 internal NavMeshLocation(Vector3 position, PolygonId polygon)
 {
     this.< position > k__BackingField = position;
     this.< polygon > k__BackingField  = polygon;
 }
示例#17
0
 internal NavMeshLocation(Vector3 position, PolygonId polygon)
 {
     this.position = position;
     this.polygon  = polygon;
 }
 private static NavMeshPolyTypes GetPolygonType(IntPtr navMeshQuery, PolygonId polygon)
 {
     return(NavMeshQuery.GetPolygonType_Injected(navMeshQuery, ref polygon));
 }
 public NavMeshPolyTypes GetPolygonType(PolygonId polygon)
 {
     AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
     return(NavMeshQuery.GetPolygonType(this.m_NavMeshQuery, polygon));
 }
 private static bool IsPositionInPolygon(IntPtr navMeshQuery, Vector3 position, PolygonId polygon)
 {
     return(NavMeshQuery.IsPositionInPolygon_Injected(navMeshQuery, ref position, ref polygon));
 }
 private static PathQueryStatus GetClosestPointOnPoly(IntPtr navMeshQuery, PolygonId polygon, Vector3 position, out Vector3 nearest)
 {
     return(NavMeshQuery.GetClosestPointOnPoly_Injected(navMeshQuery, ref polygon, ref position, out nearest));
 }
 private static extern bool GetPortalPoints_Injected(IntPtr navMeshQuery, ref PolygonId polygon, ref PolygonId neighbourPolygon, out Vector3 left, out Vector3 right);
 private static extern int GetAgentTypeIdForPolygon_Injected(IntPtr navMeshQuery, ref PolygonId polygon);
 private static extern NavMeshPolyTypes GetPolygonType_Injected(IntPtr navMeshQuery, ref PolygonId polygon);
 private static extern PathQueryStatus GetClosestPointOnPoly_Injected(IntPtr navMeshQuery, ref PolygonId polygon, ref Vector3 position, out Vector3 nearest);
示例#26
0
 static extern NavMeshPolyTypes GetPolygonType(IntPtr navMeshQuery, PolygonId polygon);
 private static extern void PolygonWorldToLocalMatrix_Injected(IntPtr navMeshQuery, ref PolygonId polygon, out Matrix4x4 ret);
 private static bool GetPortalPoints(IntPtr navMeshQuery, PolygonId polygon, PolygonId neighbourPolygon, out Vector3 left, out Vector3 right)
 {
     return(NavMeshQuery.GetPortalPoints_Injected(navMeshQuery, ref polygon, ref neighbourPolygon, out left, out right));
 }
 private unsafe static extern PathQueryStatus GetEdgesAndNeighbors_Injected(IntPtr navMeshQuery, ref PolygonId node, int maxVerts, int maxNei, void *verts, void *neighbors, void *edgeIndices, out int vertCount, out int neighborsCount);
 public bool GetPortalPoints(PolygonId polygon, PolygonId neighbourPolygon, out Vector3 left, out Vector3 right)
 {
     AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
     return(NavMeshQuery.GetPortalPoints(this.m_NavMeshQuery, polygon, neighbourPolygon, out left, out right));
 }