public static bool HiddenFace(pb_Object pb, pb_Face q, float dist) { // Grab the face normal Vector3 dir = pb_Math.PlaneNormal(pb.VerticesInWorldSpace(q)); // If casting from the center of the plane hits, chekc the rest of the points for collisions Vector3 orig = pb.FaceCenter(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); }
public static bool HiddenFace(pb_Object pb, pb_Face q, float dist) { // Grab the face normal Vector3 dir = pb_Math.PlaneNormal(pb.VerticesInWorldSpace(q)); // If casting from the center of the plane hits, chekc the rest of the points for collisions Vector3 orig = pb.transform.TransformPoint(pb.FaceCenter(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; }