当前位置: 首页>>代码示例>>C#>>正文


C# pb_Object.VerticesInWorldSpace方法代码示例

本文整理汇总了C#中pb_Object.VerticesInWorldSpace方法的典型用法代码示例。如果您正苦于以下问题:C# pb_Object.VerticesInWorldSpace方法的具体用法?C# pb_Object.VerticesInWorldSpace怎么用?C# pb_Object.VerticesInWorldSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pb_Object的用法示例。


在下文中一共展示了pb_Object.VerticesInWorldSpace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HiddenFace

    public static bool HiddenFace(pb_Object pb, pb_Face q, float dist)
    {
        // Grab the face normal
        Vector3 dir = pb_Math.Normal(pb.VerticesInWorldSpace(q.indices));

        // If casting from the center of the plane hits, chekc the rest of the points for collisions
        Vector3 orig = pb.transform.TransformPoint(pb_Math.Average(pb.GetVertices(q)));

        bool hidden = true;
        Transform hitObj = RaycastFaceCheck(orig, dir, dist, null);
        if(hitObj != null)
        {
            Vector3[] v = pb.VerticesInWorldSpace(q.indices);
            for(int i = 0; i < v.Length; i++)
            {
                if(null == RaycastFaceCheck(v[i], dir, dist, hitObj))
                {
                    hidden = false;
                    break;
                }
            }
        }
        else
            hidden = false;

        return hidden;
    }
开发者ID:BaptisteBillet,项目名称:Prochain_Arret,代码行数:27,代码来源:AutoNodraw.cs

示例2: HiddenFace

    public static bool HiddenFace(pb_Object pb, pb_Face q, float dist)
    {
        // Grab the face normal
        Vector3 dir = pbUtil.PlaneNormal(pb.VerticesInWorldSpace(q));

        // And also the center of the face
        Vector3 orig = pb.QuadCenter(q);

        // Case a ray from the center of the face out in the normal direction.
        // If an object is hit, return true (that this face is hidden), otherwise
        // return false.  This is pretty simplistic and doesn't account for a lot
        // of "gotchas", but it ought to serve as a fairly decent jumping off point
        // for NoDrawing a dense level.
        RaycastHit hit;
        if(Physics.Raycast(orig, dir, out hit, dist)) {
            // We've hit something.  Now check to see if it is a ProBuilder object,
            // and if so, make sure it's a visblocking brush.
            pb_Entity ent = hit.transform.GetComponent<pb_Entity>();
            if(ent != null)
            {
                if(ent.entityType == ProBuilder.EntityType.Brush || ent.entityType == ProBuilder.EntityType.Occluder)
                    return true;		// it's a brush, blocks vision, return true
                else
                    return false;		// not a vis blocking brush
            }
        }

        // It ain't a ProBuilder object of the entity type Brush or Occluder (world brush)
        return false;
    }
开发者ID:rickypickle,项目名称:Melody-1978,代码行数:30,代码来源:AutoNodraw.cs

示例3: SetPivot

    private static void SetPivot(pb_Object pbo, int[] testIndices)
    {
        Vector3 center = Vector3.zero;
        foreach (Vector3 vector in pbo.VerticesInWorldSpace(testIndices))
        {
            center += vector;
        }
        center /= testIndices.Length;
        Vector3 dir = (pbo.transform.position - center);

        pbo.transform.position = center;

        pbo.TranslateVertices(pbo.uniqueIndices, dir);
    }
开发者ID:rickypickle,项目名称:Melody-1978,代码行数:14,代码来源:PivotTool.cs

示例4: SetPivot

    private static void SetPivot(pb_Object pbo, int[] testIndices, bool doSnap)
    {
        Vector3 center = Vector3.zero;
        foreach (Vector3 vector in pbo.VerticesInWorldSpace(testIndices))
        {
            center += vector;
        }
        center /= testIndices.Length;

        if(doSnap)
            center = pb_Object.SnapValue(center, Vector3.one);

        Vector3 dir = (pbo.transform.position - center);

        pbo.transform.position = center;

        // the last bool param force disables snapping vertices
        pbo.TranslateVertices(pbo.uniqueIndices, dir, true);
    }
开发者ID:Jack423,项目名称:Maze-Game,代码行数:19,代码来源:PivotTool.cs


注:本文中的pb_Object.VerticesInWorldSpace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。