本文整理汇总了C#中pb_Object.QuadCenter方法的典型用法代码示例。如果您正苦于以下问题:C# pb_Object.QuadCenter方法的具体用法?C# pb_Object.QuadCenter怎么用?C# pb_Object.QuadCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_Object
的用法示例。
在下文中一共展示了pb_Object.QuadCenter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}