void Start() { BoxCollider obb = obbParent.GetComponent <BoxCollider>(); Mesh mesh = meshParent.GetComponent <MeshFilter>().sharedMesh; Debug.Log("OBB-Mesh Intersection Result: " + (OBBMeshIntersection.FindTriangles(obb, mesh.vertices, mesh.GetTriangles(0), meshParent.transform).Count > 0)); }
private void Update() { HoloToolkit.Unity.SpatialMapping.OrientedBoundingBox obb = OBBMeshIntersection.CreateWorldSpaceOBB(GetComponent <BoxCollider>()); List <int> intersecting = OBBMeshIntersection.FindTriangles(obb, m_triangleMesh.vertices, m_triangleMesh.GetTriangles(0), m_triangleXform); GetComponent <Renderer>().material.color = intersecting.Count > 0 ? Color.red : Color.green; }