- Home /
Does Physics.Raycast(All) support/use Acceleration Structures internally?
I'm currently developing a simple touch based 3d viewer. Among others it supports a Pinch to Scale Gesture that uses the distance to the mesh around the focus point (center between the touches). To obtain the distance to the Camera a Raycast is used. Since these meshes can be quite high res (and thus high res Mesh Colliders), the question arrises if the Raycast is internally implemented using Acceleration Structures like BVH, kd-tree or a BSP?
So that I don't have to care about LOD/implementation of Acceleration Structures for the collider(s). Because otherwise it might be quite expensive with "n" triangle ray intersections per frame with meshes with +100000 polys.
I believe Raycast functions use the real data and not the LOD'd data. So it will likely be a heavy call, but if you are only perfor$$anonymous$$g the call once per frame it might be fine. The Raycast function is already heavily optimized, it would actually slow it down to account for things like that.