本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}