I’m trying to make a rigidbody roll along the deformation of a mesh underneath it.
However, the mesh is being deformed through GPU, which apparently the rigidbody isn’t naturally detecting.
How can one communicate to the rigidbody where the GPU-deformed mesh vertices are, so that the rigidbody can position along the GPU-deformed mesh vertices as such?
Mesh deformation happens in vertex shader during rendering. You could, in theory, stream out and download the vertices back to main memory, but I am not sure if Unity api allows that (maybe it does, I just don’t know). Anyway that would be asynchronous and delayed process and rebuilding the collider every frame would not be super fast either. Your best bet is to recreate the collision mesh from smaller convex / primitive colliders. There’s no straightforward solution to your problem AFAIK
if you want to modfy anything in the gpu and that the cpu updates it in the same frame you will have to use compute shaders. With that you can ask the gpu to execute some code and get the new modified geometry back to update the collider. You can also keep the calculation stored in a gpu buffer and read it from a custom shader to not send so much information back and forth(last time i checked it was not aviable for shadergraph).