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; }