Unity ComputeShader implementation of BVH(Bounding Volume Hierarchy) based mesh hit checking.
Add the following address to UnitPackageManager.
https://github.com/fuqunaga/ComputeShaderBVHMeshHit.git?path=/Packages/ComputeShaderBVHMeshHit
- Window > BvhBuilder
- Set
meshObjectRoot
object. - Build to create BvhAsset.
- Put BvhHelperBehaviour to the Hierarchy.
- Set BvhAsset.
- Call
BvhHelperBehaviour.SetBuffersToComputeShader()
.
- Add the following include statement to your ComputeShader.
#include "Packages/ga.fuquna.computeshaderbvhmeshhit/Bvh.hlsl"
- Call
TraverseBvh()
to detect a mesh hit.