- Home /
Mesh Collision on Displacement Shader
I'm a little confused on how to get a collider on my mesh that has been modified using a custom displacement shader.
As far as I know, I need to create another mesh, deform it and then update the collider on that, then line that up with my displaced mesh.
Problem is, I have no idea what I need to access to get it to deform in the same shape as my displacement shader.
I'm displacing the mesh in the shader using a heightmap, so would I need to create a script to use that heightmap too? Or can I somehow access the new positions of the vertices after they have been displaced?
Any insights as to how I can achieve this?
Answer by FortisVenaliter · May 21, 2015 at 04:54 PM
Honestly, for objects with collision, I would bake it into a static mesh, then use that mesh for both the collider and the renderer, especially if it's terrain.
You pretty much have to generate and store the collider mesh on the CPU side, so I would just bring the render mesh generation around to the CPU side as well while you're at it.
If the mesh is dynamic and moving, then you're going to have more trouble, especially as physics engines don't seem to like that very much.
is there any way to get the mesh information from the shader? I'd like to avoid doing the displacement in the CPU altogether if possible.
Your answer
Follow this Question
Related Questions
Leap motion: how to pickup a custom mesh 0 Answers
boxcollider fixed bounds 1 Answer
Mesh breaks apart when using vertex displacement with shadergraph. 3 Answers
How to render a lot of the same small objects 2 Answers
Change a part of a mesh's properties 0 Answers