Code: Select all
Space.BroadPhase.QueryAccelerator.GetEntries
How can I do the same thing but with the triangles of a StaticMesh without have to test against all the triangles in the mesh (i.e. using a built in "accelerator")?
Code: Select all
Space.BroadPhase.QueryAccelerator.GetEntries
Code: Select all
if(staticMesh.Mesh.Tree.GetOverlaps(boundingShape, overlapsList))
{
//Do stuff
}
Code: Select all
List<int> triangleIndices = new List<int>();
// Test for overlapping triangles in the static mesh
StaticMesh mesh = c as StaticMesh;
mesh.Mesh.Tree.GetOverlaps(boundingSphere, triangleIndices);
Vector3 vertexA;
Vector3 vertexB;
Vector3 vertexC;
int numIntersected = triangleIndices.Count;
for (int t = 0; t < numIntersected; ++t)
{
mesh.Mesh.Tree.TriangleMeshData.GetTriangle(triangleIndices[t], out vertexA, out vertexB, out vertexC);
triangles[numTriangles++] = new Triangle(vertexA, vertexC, vertexB);
}