示例#1
0
        /// <summary>
        /// Finds a set of predefined points on an edge. Normally it's only
        /// three - start, middle and end. If the edge type is "principal"
        /// and the target has a Collide.Shape, additional points at the surface
        /// of the shape may appear.
        /// </summary>
        /// <param name="edge">Edge to find predefined points on.</param>
        /// <returns>Iterator to point on the edge.</returns>
        private IEnumerable <Vector3> FindPredefinedEdgePoints(MeshUtils.Edge edge)
        {
            yield return(edge.Start);

            yield return(edge.Center);

            yield return(edge.End);

            if (edge.Type == MeshUtils.Edge.EdgeType.Triangle || m_collectedData == null || m_collectedData.Target == null || m_collectedData.Target.GetComponent <Shape>() == null)
            {
                yield break;
            }

            ShapeUtils utils = m_collectedData.Target.GetComponent <Shape>().GetUtils();

            if (utils == null)
            {
                yield break;
            }

            ShapeUtils.Direction[] edgeDirections = ShapeUtils.ToDirection(ShapeUtils.ToPrincipal(utils.FindDirectionGivenWorldEdge(edge)));
            yield return(utils.GetWorldFace(edgeDirections[0]));

            yield return(utils.GetWorldFace(edgeDirections[1]));
        }